FTP Commands

  • Thread starter Thread starter Waldy
  • Start date Start date
W

Waldy

Hi there,
this is not strictly an XP issue but I could see anywhere
obvious to post.

I am using the FTP command to periodically download and upload files. For
the download, I am issuing an mget * and then an mdelete * command, The
problem with this is that there is the potential for a file to arrive in the
remote folder between the download and deletion commands, meaning that files
can be missed.

Anyone have a more elegant solution?
 
Hi there,
this is not strictly an XP issue but I could see anywhere
obvious to post.

I am using the FTP command to periodically download and upload files. For
the download, I am issuing an mget * and then an mdelete * command, The
problem with this is that there is the potential for a file to arrive in the
remote folder between the download and deletion commands, meaning that files
can be missed.

Anyone have a more elegant solution?

http://filezilla-project.org

- Thee Chicago Wolf [MVP]
 
I am using the FTP command to periodically download and upload
files. For the download, I am issuing an mget * and then an
mdelete * command, The problem with this is that there is the
potential for a file to arrive in the remote folder between the
download and deletion commands, meaning that files can be missed.

Anyone have a more elegant solution?

How about using a different tool than Microsoft's FTP, like WGET. You
could invoke WGET twice, the second time with the "-N," or
"--timestamping" switch. It will retrieve only the files that are newer
or weren't there the first time.

WGET can retrieve files by both FTP and HTTP.

<http://www.gnu.org/software/wget/manual/wget.html#Time_002dStamping>

<http://gnuwin32.sourceforge.net/packages/wget.htm>
 
Depending on how good a script writer you are you can do this in a script:
1. log on to the ftp site
2. mget the files
3. log off ftp
4. redirect a "dir" list of the files to a temp file
5. massage the temp file into a list of ftp "del" commands.
6. log back onto the ftp site and use the temp file as a command file (-s
option)

This would be doable but painful in cmd shell, maybe not so bad in vbscript,
very easy in a *NIX shell such as bash.

DR
 
Back
Top