0

I have a huge amount of directories with a similar subfolder structure. Each dir has a subdir "s". Some dirs have a "_tmp" -prefix in the name.

What I want is to copy all the main dirs to a new server, but leave the s-subdirs and _tmp -dirst out of the transfer.

On OSX (rsync v. 2.6.9) this command works fine:

rsync -avz --exclude */s/* --exclude *_tmp SOURCE/ DEST/

But on Ubuntu (rsync v. 3.0.7) the same command fails, _tmps are out but the s-folders are still in. Any workarounds?

2

I would ask you to prepend your command with echo to see what you are running.

echo rsync -avz --exclude */s/* --exclude *_tmp SOURCE/ DEST/

Depending on your shell, your shell settings, and the contents of your current directory, the unquoted *_tmp may be expanded into a particular file (which probably won't match most of the ones you want to exclude). The echo should show what is actually happening.

You should protect the asterisks with quotes to prevent shell expansion.

rsync -avz --exclude '*/s/*' --exclude '*_tmp' SOURCE/ DEST/

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.