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/
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…