Page 1 of 1

Getting file size

Posted: Sat Nov 14, 2009 2:45 pm
by Andycal
I seem to be missing a trick here. The 'files' command puts all files in a folder into a variable which I can then find the file size for, but I just want to get the file size for a file I know the name of.

Do I really need to list all the files in a directory, then find it in the array and then get the file size? Seems a bit bonkers.

I've already got the file name as the result of an 'answer' command, can't I do something like :

Code: Select all

put the filesize of tFile into tSize

Posted: Sat Nov 14, 2009 3:27 pm
by RRobert

Posted: Sat Nov 14, 2009 5:56 pm
by Andycal
Blimey, great thread!

Just goes to show, there are many ways to skin this cat. Odd though, with a language that offers so many ways to do very simple things in one-liners, it's amazing it's such a faff to so something like get a file size.

Got it working now though, and I guess I learned something!