[Tutor] Looking for something similar to du...

Spencer Parker inthefridge at gmail.com
Tue May 6 05:59:30 CEST 2008


Mark is right...in that I don't want the actual size of the file
itself...that I can get from another way in Python which i am already
doing.  I was mainly wondering if there was a way to do it and I was just
missing something.  I looked though stat() and that is basically what I
wanted.  I wasn't sure if that was actually it until Mark spelled it out for
me.  I do love using du...since I am learning..I just wanted make sure I
wasn't missing anything...thank you guys as always...


On Mon, May 5, 2008 at 6:57 PM, Marc Tompkins <marc.tompkins at gmail.com>
wrote:

> On Mon, May 5, 2008 at 5:21 PM, Alan Gauld <alan.gauld at btinternet.com>
> wrote:
>
>> Probably but I'm not totally clear what you are looking for.
>> Can you explain what you mean by the diffrence between the size
>> used versus the size of the image? Surely the size of the image
>> is the space it uses? Or are you expanding compressed files?
>>
>
> Disk space is allocated in large units (in DOS/Windows they're called
> "clusters", *nixes call them "blocks").  A one-byte file still uses an
> entire cluster, whose size depends on the size of the disk and the number of
> chunks it can be divided into.  So just knowing the size of the file is not
> quite enough information if you need to know how much room is left on the
> disk...
>
> If you use Windows, you can see this very easily - right-clicking on a JPEG
> file and selecting Properties, I get:
> Size:             35.1 KB (35,997 bytes)
> Size on disk: 48.0 KB (49,152 bytes)
>
> From the os.stat() docs:
>
>> On some Unix systems (such as Linux), the following attributes may also
>> be available: st_blocks (number of blocks allocated for file), st_blksize(filesystem blocksize),
>> st_rdev (type of device if an inode device). st_flags (user defined flags
>> for file).
>>
> So apparently os.stat() can get this info from *nix, but not Windows...
> maybe behind the scenes, it runs du?
> --
> www.fsrtechnologies.com
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>


-- 
Spencer Parker
_______________________________________________________

"if you can't go to heaven, may you at least die in Ireland."

_______________________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20080505/dabe4874/attachment.htm>


More information about the Tutor mailing list