FTP Requests
Dave Cragg
dcragg at lacscentre.co.uk
Fri Dec 12 00:42:17 EST 2003
At 2:11 pm -0500 11/12/03, Ray Horsley wrote:
>Hi Listers,
>
>I'm currently working on a project using Metacard's ability to move files
>between my local computer and an FTP site. I'm using the following syntax:
>
>Put url "ftp://userName:userPassword@mySite.com/myFolder/myFile/" into
>myLocalFilePath
>
>Can anybody help me with the syntax to also do the following:
>
> 1) delete an FTP file
As Klaus said, delete url ftp://whatever
> 2) change the directory of an FTP file (without having to rewrite it)
I take it you mean change the directory name and not move files to a
different directory.
This is a bit messy, but can be done with libUrlFtpCommand.
First use the CWD command to change to the directory that contains
the one you want to change. Then use RNFR and RNFT to change the name.
put "ftp.myserver.com" into tHost
put "dave" into tName
put "secret" into tPass
put "olddirname" into tFrom
put "newdirname" into tTo
put "CWD /path/to/parent/folder" into tCmd
get libUrlFtpCommand(tCmd,tHost,tName,tPass)
if word 1 of it is 250 then ##check for success
put put "RNFR" && tFrom into tCmd
get libUrlFtpCommand(tCmd,tHost,tName,tPass)
if word 1 of it is 350 then##really 350 this time
put put "RNTO" && tTo into tCmd
get libUrlFtpCommand(tCmd,tHost,tName,tPass)
if word 1 of it is not 250 then
## error stuff
end if
end if
end if
By the way, if you have Fetch on a Mac, a good way to discover the
FTP command syntax is to open the transcript window, perform the
actions you want to emulate, and note the commands that were issued.
(I guess other FTP clients probably have the same feature.)
Cheers
Dave
More information about the metacard
mailing list