Monday, 15 September 2014

bash - How to clean up directory structure from botched rsync operation? -



bash - How to clean up directory structure from botched rsync operation? -

in bash script, rsync'ing many directories. however, in script forgot set trailing slash @ end of source directory. result, have like

rsync /first/path/dir /second/path/dir

in script, know wrong, , ends creating

/second/path/dir/dir

in destination directory, not want @ all.

is there quick way can utilize find command find instances of "dir/dir" , perform 'rm -rf' without losing other original contents of /second/path/dir ?

you can utilize -path argument unix find command locate (and remove) 'dir/dir'

find . -path \*/dir/dir -exec rm -rf {} \;

bash directory rsync

No comments:

Post a Comment