I have a task where I need to take a collection of files on a remote
server and transfer them, one at a time, a local server, deleting each
remote file as it is successfully transferred. The reason for the
delete-as-transfer phase is that there are potentially a lot of files
and the task is likely to be interrupted, so it is intended to save disk
space on the remote server (there could be very long periods before a
sync actually fully completes to run a separate cleaning script).

At present I'm doing this with a script that uses ssh to initially get
the list of remote files to transfer, and then loops over each file
doing an scp and then (upon success) doing an ssh to remove the remote
file. Nothing fancy, naturally, but after starting to use rsync for
other tasks it occurs to me that rsync would be a much better tool if it
had a mode which would allow this behavior (since the current script
involves creating many ssh sessions, exactly the thing that rsync is
designed to minimize).

Can rsync do this?

--
__ Erik Max Francis && max@alcyone.com && http://www.alcyone.com/max/
/ \ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
\__/ Education is a state-controlled manufactory of echoes.
-- Norman Douglas