Hi all, I have a particular request: I was asked whether when --delete is specified on the client, the daemon can, instead of delete the file, move it to a "trash" directory. The path of the latter may be hardcoded and it is not important to retain info about original path etc.. Not sure whether --backup or some similar option can do this just for deleted files... I was looking through the source to see if this can be hard-coded, and it seems that the function "delete_item" is where it should be done.. specifically in "do_unlink", where one could hard-code a "copy_file" to a fixed trash directory before unlink... Any suggestions?? Cheers Julian
On Wed 28 Mar 2007, Julian wrote:> Hi all, I have a particular request: > I was asked whether when --delete is specified on the client, the daemon > can, instead of delete the file, move it to a "trash" directory. > The path of the latter may be hardcoded and it is not important to > retain info about original path etc.. > > Not sure whether --backup or some similar option can do this just for > deleted files... I was looking through the source to see if this can beA simple test (much easier than looking at the source :-) : $ cd /tmp $ mkdir x y $ rm -rf z $ date > y/foo $ rsync -av --delete --backup --backup-dir=../z x/ y building file list ... done deleting foo ./ sent 77 bytes received 26 bytes 206.00 bytes/sec total size is 0 speedup is 0.00 $ ls -l y total 0 $ ls -l z total 4 -rw-r--r-- 1 paul staff 30 Mar 28 17:00 foo So, yes, it's possible. Paul Slootman
On Wed, Mar 28, 2007 at 03:51:26PM +0200, Julian wrote:> I was asked whether when --delete is specified on the client, the > daemon can, instead of delete the file, move it to a "trash" > directory.That's what the --backup option will do when a --backup-dir is specified. However, it also copies all changed files into the backup hierarchy as well. There is a diff in the patches dir named backup-dir-dels.diff that allows you to separate deletions from updated files. ..wayne..
Possibly Parallel Threads
- [patch] Make robust_rename() handle EXDEV.
- patch for better handling of write failures (disk full)
- PATCH: better handling for write failures (disk full)
- Patch to not modify files in place unless "--inplace" option specified
- new option suggestion '--backup-only'