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.

best,

Chipp

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


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 --

_______________________________________________
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution

_______________________________________________
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to