[Pythonmac-SIG] size (newbie)
Jack Jansen
Jack.Jansen@cwi.nl
Tue, 15 Sep 1998 23:36:14 +0200
Recently, JoanCarles p Casas=?ISO-8859-1?Q?=edn?= <joanca@seker.es> said:
> hi,
>
> is possible to get the size (Kb) of a file? and if it is, how?
There are a few ways to do this, depending on what you're interested
in. If you want to get the size of the data fork only the best method
is os.stat(). The sixth value is the size of the data fork. This
method is portable to other platforms.
If you want the full size use os.xstat(). rv[6] is again data fork
size, rv[10] is the resource fork size. xstat is mac-specific.
You can also use the GetFInfo() method of a macfs.FSSpec object, if
that is handier. Again, mac-specific.
Note that all these methods give you the number of bytes in the file,
*not* the amount of space it occupies on disk (the finder info command
gives both). Does anyone know how to obtain the diskspace numbers?
--
Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++
http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm