rsync delete files on sending side after transfer

前端 未结 1 1519
北恋
北恋 2021-02-02 07:26

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

相关标签:
1条回答
  • 2021-02-02 08:13

    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/

    0 讨论(0)
提交回复
热议问题