Get the filesize?

Chipp Walters chipp at
Tue Feb 5 03:32:01 EST 2002

I'm on a PC...

This looks like the ticket, Shao. Thx! I thought there might be an easier
way. BTW, I think I'll insert a put the defaultFolder into oldDefaultFolder
before changing it, that way I can restore it at the end.



-----Original Message-----
From: use-revolution-admin at
[mailto:use-revolution-admin at]On Behalf Of Shao Sean
Sent: Tuesday, February 05, 2002 2:18 AM
To: use-revolution at
Subject: Re: Get the filesize?

returns -1 if it can't find the file.. you can change this to suit your

-- 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
          return item 2 of vDirectoryListingLine
        end if
      end if
    end repeat
    return -1
  end if
end getFileSize
-- End Code --

use-revolution mailing list
use-revolution at

More information about the Use-livecode mailing list