Subbu, thanks for the hint to look for the directoryEntry.<br><br>I have working code (see example).<br>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).<br>
But the fileSize = 0.<br><br>1. What is going wrong with the fileSize, because the file is much bigger than 0!<br><br>2. How can I change creationTime to something readable? Now it is a LargePositiveInteger, not very useful to display.<br>
<br>| aFileDir aFile | <br><br> aFileDir := (FileDirectory default directoryNamed: 'mytestdir').<br> aFile := aFileDir directoryEntryFor: 'my test file.mp3'.<br> Transcript cr;show: aFile creationTime printString.<br>
Transcript cr;show: aFile fileSize printString.<br><br>Regards,<br>Van.<br><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi,<br>
<br>
I'm listing files in a directory, but I want to show more than just the<br>
filename (like file size and may be creation date). I've searched for some<br>
time on the Internet, but I can't find the answer. How to do this?<br>
<br>
I've tried this:<br>
aFile := (FileDirectory default directoryNamed: directoryName)<br>
assureExistence;<br>
readOnlyFileNamed: 'testfile.pdf'.<br>
and then tried: aFile size but that doesn't seem to work.<br>
<br>
Regards,<br>
Van.<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <a href="http://lists.squeakfoundation.org/pipermail/beginners/attachments/20100320/c8e4ab01/attachment-0001.htm" target="_blank">http://lists.squeakfoundation.org/pipermail/beginners/attachments/20100320/c8e4ab01/attachment-0001.htm</a><br>
<br>
------------------------------<br>
<br>
Message: 5<br>
Date: Sat, 20 Mar 2010 21:11:59 +0530<br>
From: "K. K. Subramaniam" <<a href="mailto:subbukk@gmail.com">subbukk@gmail.com</a>><br>
Subject: Re: [Newbies] determining file size?<br>
To: <a href="mailto:beginners@lists.squeakfoundation.org">beginners@lists.squeakfoundation.org</a><br>
Cc: Van Upboy <<a href="mailto:van.upboy@gmail.com">van.upboy@gmail.com</a>><br>
Message-ID: <<a href="mailto:201003202111.59879.subbukk@gmail.com">201003202111.59879.subbukk@gmail.com</a>><br>
Content-Type: Text/Plain; charset="iso-8859-15"<br>
<br>
On Saturday 20 March 2010 09:02:32 pm Van Upboy wrote:<br>
> I'm listing files in a directory, but I want to show more than just the<br>
> filename (like file size and may be creation date). I've searched for some<br>
> time on the Internet, but I can't find the answer. How to do this?<br>
File size is an attribute of the file's entry in its directory.<br>
<br>
See fileSize method in DirectoryEntry class. If you already have a file handle<br>
or a stream opened on it, use directoryEntry method. E.g.<br>
<br>
stream directoryEntry fileSize<br>
<br>
HTH .. Subbu<br>
<br></blockquote></div><br><div style="visibility: hidden; display: inline;" id="avg_ls_inline_popup"></div><style type="text/css">#avg_ls_inline_popup { position:absolute; z-index:9999; padding: 0px 0px; margin-left: 0px; margin-top: 0px; width: 240px; overflow: hidden; word-wrap: break-word; color: black; font-size: 10px; text-align: left; line-height: 13px;}</style>