I must be missing something real important, here is my problem :
using the ‘info for’ command I’m retrieving the size of a file (in bytes) adI 'm trying to convert it to kilobytes or megabytes using the formula :
1 kilobytes = 1024 bytes
1 megabytes = 1024 kilobytes = (1024)^2 bytes
And the result is not whta is shown in the info window. Can someone explain it to me?
Here are a couple of quotes from Chris Nebel, AppleScript engineer. These statements were made at different times in response to different questions, but they might help. Obviously, you’ve already touched on some of the issues mentioned by Chris.
Thanks Rob
Here is a little handler dedicated to finding the size taken by the file on the disk (physical size) without using the Finder
on getFileSize(PathToFile)
set myOffSet to offset of "/" in (reverse of characters of PathToFile as string)
set lastcar to ((count PathToFile) - myOffSet) + 1
set ParentPath to characters 1 thru lastcar of PathToFile as string
set FileName to characters (lastcar + 1) thru -1 of PathToFile as string
do shell script "cd " & ParentPath & ";" & "ls -sk | grep " & FileName & " | awk '{print $1}'"
end getFileSize