Get the filesize?
Shao Sean
shaosean at unitz.ca
Mon Feb 4 22:20:12 EST 2002
returns -1 if it can't find the file.. you can change this to suit your
needs
-- Start code --
function getFileSize pFullFilePath
# Declare the variables
local vFilePath, vFileName, vDirectoryListing, vDirectoryListingLine
# Split the file's path and name
set the itemDelimiter to "/"
put the last item of pFullFilePath into vFileName
put pFullFilePath into vFilePath
delete last item of vFilePath
set the itemDelimiter to comma
# Change the directory
set the defaultFolder to vFilePath
# Get the directory listing
put the detailed files into vDirectoryListing
# Find our file and return the file size
if (vFileName is among the items of vDirectoryListing) then
repeat for each line vDirectoryListingLine in vDirectoryListing
if (item 1 of vDirectoryListingLine = vFileName) then
if (the platform is "MacOS") then
return item 2 of vDirectoryListingLine + item 3 of
vDirectoryListingLine
else
return item 2 of vDirectoryListingLine
end if
end if
end repeat
else
return -1
end if
end getFileSize
-- End Code --
More information about the use-livecode
mailing list