Page 1 of 1

Extracting File Size

Posted: Tue Oct 14, 2008 4:35 pm
by warrenk
I loaded a list of files (detail information) into tAllFiles. How do I extract the size from the list into a variable? Is there a command that allows me to extract this?

repeat for each line tFile in tAllFiles
...not sure about the command to extract the file size?

Thanks,
Warren

Posted: Tue Oct 14, 2008 4:54 pm
by Janschenkel
The file size (in bytes) is in the second item - and if you're on Mac, you may also be interested in the third item for _very_ old files which also contain a resource fork.

Code: Select all

put the detailed files into tDetailedFiles
repeat for each line tDetailedFile in tDetailedFiles
  put item 1 of tDetailedFile into tFileName
  put item 2 of tDetailedFile into tFileSize
  divide tFileSize by 1024 -- convert to KB
  put tFileName & comma & tFileSize & return after tFileNamesAndSizes
end repeat
delete char -1 of tFileNamesAndSizes -- remove trailing return
If you're looking at converting the creation or modification dates, those are given as 'seconds', so you're looking at

Code: Select all

  put item 4 of tDetailedFile into tCreationDate
  convert tCreationDate from seconds to system date and system time
Hope this helped,

Jan Schenkel.

Posted: Tue Oct 14, 2008 5:00 pm
by warrenk
Jan,

Thanks for taking your time to help me out. Really appreciate it! :lol:

Warren