Let's have a --remove-source-files option that works like --remove-sent-files but removes from the source everything in the file list, not just transferred files. Then I could use rsync for my primary move command (via a wrapper called "mv2") as well as my primary copy command ("cp2").
Yes, I think this is a good idea, particularly because of the problem rsync has doing the right thing when restarting an interrupted transfer that is using --remove-sent-files (i.e. some of the sent files might not get removed).
Because of this, I'm thinking about deprecating --remove-sent-files (but leaving it supported to work with older versions).
Is there a possible ETA for this feature? It would nicely solve the problem I have with files getting left over after a GPRS link goes down in mid-transfer. My current, and rather gross, solution is to summarily delete everything in the transfer directory after rsync completes successfully.
(In reply to comment #0)
> Let's have a --remove-source-files option that works like --remove-sent-files
> but removes from the source everything in the file list, not just transferred
> files. Then I could use rsync for my primary move command (via a wrapper
> called "mv2") as well as my primary copy command ("cp2").
Created attachment 2010 [details]
Add --remove-source-files option
Here is a patch that adds the --remove-source-files option and deprecates the --remove-sent-files option. I've also checked this into CVS, so it is also available from there or the latest nightly tar file.
The code is young, but should be safe as most of the functionality was taken from remove-sent-files. I've run basic tests on it, and it works fine.
A --remove-source-files option was added in 2.6.9, but it does not remove source directories, and I would like it to remove them so that "rsync --remove-source-files" can be used as a mv replacement. Specifically, I would like the sender to do the following:
(1) Remove each empty source directory as soon as the generator processes it. (For this to work, the generator would need to send MSG_SUCCESS after processing a directory with no contents in the file list; maybe the --prune-empty-dirs code could be reused to flag such directories.)
(2) After removing each source file, check whether the parent directory is empty and in the file list. If so, remove it and recursively consider /its/ parent for removal.
I would be satisfied if a separate option or repetition of --remove-source-files activated this behavior.
What's the status of this feature? The directory deletion feature is still missing. I'm on 2.6.9 but I couldn't find changes in the Changelog of 3.0.
registered a new account here for this one. really nobody has cared enough to implement it yet?
# rsync --version
rsync version 3.0.5 protocol version 30
I'm also quite interested in this feature. Rsync is already the perfect augmentation of the cp command, and adding this feature would similarly allow an easy drop-in augmentation of the mv command.
I too am interested in this feature as I pull from a remote server that I have no shell access too.
I don't have access to run rm -rf or such after the pull is complete so I just have hundred of empty directories sitting on that server.