determining file size?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

determining file size?

Van Upboy
Hi,

I'm listing files in a directory, but I want to show more than just the filename (like file size and may be creation date). I've searched for some time on the Internet, but I can't find the answer. How to do this?

I've tried this:
    aFile := (FileDirectory default directoryNamed: directoryName)
            assureExistence;
            readOnlyFileNamed: 'testfile.pdf'.
    and then tried: aFile size but that doesn't seem to work.

Regards,
Van.

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: determining file size?

K. K. Subramaniam
On Saturday 20 March 2010 09:02:32 pm Van Upboy wrote:
> I'm listing files in a directory, but I want to show more than just the
> filename (like file size and may be creation date). I've searched for some
> time on the Internet, but I can't find the answer. How to do this?
File size is an attribute of the file's entry in its directory.

See fileSize method in DirectoryEntry class. If you already have a file handle
or a stream opened on it, use directoryEntry method. E.g.

  stream directoryEntry fileSize

HTH .. Subbu

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners