I'm periodically calling rsync --remove-source-files -r source/logs/ dest:logs/ to synchronize log files from a mobile unit with inadequate storage to my reliable server with ample storage.

Sometimes, because of unstable connections, the rsync fails. --append usually fixes any problems and moves on when a transfer was interrupted midway.

Sometimes however, the file is fully transferred but the indication of this is not transmitted back to the source. So the source, correctly, does not remove the source file.

The problem is that the next time the rsync is run, the file on the remote exactly matches the one locally. So rsync removes it from the list of files to transfer. This unfortunately means that the local file, that was correctly transferred, gets pruned from the transfer list and thus is not removed after a transfer.

Is there some option to rsync I'm missing or will I need to have a follow-up job that removes aging files?


Please go through : RSYNC Does Not Delete Source Directories

You can read examples of rsync command on page by using man rsync

I think it would be great if you have follow up job which will clear source files. You can use "find" command to clear aging files.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.