Determine cluster size of file system in Python

Posted by Philip Fourie on Stack Overflow See other posts from Stack Overflow or by Philip Fourie
Published on 2010-03-22T14:54:53Z Indexed on 2010/03/22 15:01 UTC
Read the original article Hit count: 260

Filed under:
|

I would like to calculate the "size on disk" of a file in Python. Therefore I would like to determine the cluster size of the file system where the file is stored.

How do I determine the cluster size in Python? Or another built-in method that calculates the "size on disk" will also work.

I looked at os.path.getsize but it returns the file size in bytes, not taking the FS's block size into consideration.

I am hoping that this can be done in an OS independent way...

© Stack Overflow or respective owner

Related posts about python

Related posts about filesystems