I am after an FTP script to download all the files from an FTP server, then delete these files once complete, but leave files on the remote server if any were added during the download process, to be fetched during a later session.
Is it possible to achieve something like this using FTP scripts or do I need a different solution.
I was planning on using psftp.
Based on Maxwell's answer to this question, I would probably do something along the lines of this pseudocode:
Use
$favorite_scripting_language
to gather the list of filenames to d/l then kill; write an output file namedscript.txt
in the form:then wrap it up with:
How about python? As a plus, it should work more or less unmodified on any OS. And the even bigger plus is that it is more flexible that using the other, more brittle, methods.
It would go something like this:
You have to add error checking and other such stuff. The same could be accomplished with perl and it would probably look about the same.