Rsync delete files on the send side after transfer

I want to download a large amount of data from a remote machine. I would like the data to be deleted on the remote machine every time the file finishes downloading.

How can I do it? Is there a flag for rsync for this?

+6
source share
1 answer

You need to pass the --remove-source-files option to the rsync command. It tells rsync to delete from the sending side files (which means non-directories) that are part of the transfer and have been successfully duplicated on the receiving side. Do not pass the --delete parameter to the rsync command, as it removes extraneous files from the destination directory. Delete source after successful transfer using rsync

Syntax:

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 

Link: http://www.cyberciti.biz/faq/linux-unix-bsd-appleosx-rsync-delete-file-after-transfer/

+11
source

Source: https://habr.com/ru/post/972373/


All Articles