I want to move files from server1 to server2.
A producer on server1 will keep generating the files, and a consumer on server2 will keep processing them.
I can copy files using the following shell script:
rsync path/*.txt server2:/path
The extension of the files on the destination (server2) will be changed from .txt to .done once they are processed, so if I run the command again, the files will once again copied (and processed) to the destination.
Hence, I want to delete (or rename or move) the original files so that they won't be transferred again.
I am using rsync
version 2.6.3, which does not have --remove-source-files option.
I am new to shell scripting, so please give an example.
tee
and process substitution for this. for eg: usefind
to find your files and usetee
to send the output to bothrsync
andrm
see this – harish.venkat Jan 14 '13 at 11:14