ftping and filetype property
Rob Cozens
rcozens at pon.net
Tue Sep 16 19:43:40 EDT 2003
>I'm having trouble finding the Rev command to
>retrieve the filetype of a file on the hard-drive, before uploading to
>the server via FTP. Did you have to use Applescript to retrieve this info?
Hi Rob,
There is no command I'm aware of to retrieve the fileType of a
specific file; however the type is included with the information
returned on each file in the default folder via the detailed files
command (item 11).
The following creates a file info footer that is appended to SDB
Utilities compressed files:
function sgzFooter fullFileName
set the itemDelimiter to "/"
put item -1 of fullFileName into shortFileName
put item 1 to -2 of fullFileName into filePath
put the defaultFolder into savedDefaultFolder
set the defaultFolder to filePath
put the detailed files into folderContents
set the defaultFolder to savedDefaultFolder
set the itemDelimiter to comma
repeat for each line fileEntry in folderContents
if URLDecode(item 1 of fileEntry) <> shortFileName then next repeat
put fileEntry into returnFooter
exit repeat
end repeat
if the platform is "MacOS" then return returnFooter
switch (char -4 to -1 of fullFileName)
case ".rev"
put "revoRSTK" into item 11 of returnFooter
break
case ".txt"
put "ttxtTEXT" into item 11 of returnFooter
break
default
if char -3 to -1 of fullFileName = ".mc" then put "MCRDMSTK" into
item 11 of returnFooter
else put "????????" into item 11 of returnFooter
end switch
return returnFooter
end sgzFooter
Note that on non-Mac platforms there is logic to add Mac OS file
types for .rev, .txt, and .mc files.
On decompression, the file type is retrieved from the footer.
--
Rob Cozens
CCW, Serendipity Software Company
http://www.oenolog.net/who.htm
"And I, which was two fooles, do so grow three;
Who are a little wise, the best fooles bee."
from "The Triple Foole" by John Donne (1572-1631)
More information about the use-livecode
mailing list