On Sun, 2007-11-04 at 13:50 -0800, Jesse Thompson wrote: > What would be the closest approximation to something like this? > > # rsync -r --just-nuke-the-target remote::volume/directory > > Is it something that can be done with rsync?
Yes, but it is a bit awkward because rsync considers deletion of an extraneous destination file to be part of the processing of its parent directory. One simple approach is to push a directory to the parent of "directory" (i.e., the module) and use filters to make the source effectively empty and to prevent anything other than "directory" from being deleted from the destination: rsync -d --del --filter='R /directory' --filter='- /*' . remote::volume Here is how you would write an "rsyncrm" script that can be invoked like "rsyncrm -ni remote::volume/directory". Note that this reveals the attributes of the current directory to the server. #!/bin/bash victim="${@: -1:1}" rsync -d --del --filter="R /$(basename -- "$victim")" --filter='- /*' \ "${@:1:$#-1}" . "$(dirname -- "$victim")" Matt -- To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html