I want to download a large amount of data from a remote machine. I\'d like the data to be erased on the remote machine everytime a file finishes downloading.
How do I do
You need to pass the --remove-source-files
option to the rsync
command. It tells rsync
to remove from the sending side the files (meaning non-directories) that are a part of the transfer and have been successfully duplicated on the receiving side. Do not pass the --delete
option to rsync
command as it delete extraneous files from destination directory.
Delete source after successful transfer using rsync
.
The syntax is:
rsync --remove-source-files -options /path/to/src/ /path/to/dest
rsync --remove-source-files -options /path/to/src/ computerB:/path/to/dest
rsync --remove-source-files -av /path/to/src/*.avi computerB:/path/to/dest
Reference : http://www.cyberciti.biz/faq/linux-unix-bsd-appleosx-rsync-delete-file-after-transfer/