Subbu, thanks for the hint to look for the directoryEntry. I have working code (see example). When I inspect aFile then the other variables are there (for instance, there is a creationTime which contains a number, and there is a fileSize). But the fileSize = 0.
1. What is going wrong with the fileSize, because the file is much bigger than 0! 2. How can I change creationTime to something readable? Now it is a LargePositiveInteger, not very useful to display. | aFileDir aFile | aFileDir := (FileDirectory default directoryNamed: 'mytestdir'). aFile := aFileDir directoryEntryFor: 'my test file.mp3'. Transcript cr;show: aFile creationTime printString. Transcript cr;show: aFile fileSize printString. Regards, Van. 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. > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: > http://lists.squeakfoundation.org/pipermail/beginners/attachments/20100320/c8e4ab01/attachment-0001.htm > > ------------------------------ > > Message: 5 > Date: Sat, 20 Mar 2010 21:11:59 +0530 > From: "K. K. Subramaniam" <subb...@gmail.com> > Subject: Re: [Newbies] determining file size? > To: beginners@lists.squeakfoundation.org > Cc: Van Upboy <van.up...@gmail.com> > Message-ID: <201003202111.59879.subb...@gmail.com> > Content-Type: Text/Plain; charset="iso-8859-15" > > 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 Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners