Obtaining the size of a file

Bill Marriott wjm at wjm.org
Sat Apr 21 04:03:26 EDT 2007


John,

> I'm recursing through a (sometimes large) list of files and folders which 
> can take a while, so I was trying to avoid another function call per line.

Josh's function is pretty speedy. And, if you know you are going to process 
all the files in a directory, then you can store a copy of the detailed 
files before filtering for the specific file you want.

> I've written several handlers in the past for things only to discover 
> later that there is a command that does the task in a one liner [...]

Another way to make quick work of the detailed files is to put them into an 
array:

   put the detailed files into foobar
   split foobar by return and comma

then you can say,

   get item 1 of foobar[urlencode(myFileName)]

to obtain the file size. How's that for a one-liner?





More information about the use-livecode mailing list