0

I have got a rsync task and want to exclude my ./js/ folder. Because of that I use:

--exclude js

What happens now is that not only the ./js/ folder, but although the ./assets/js/ folder will not be synced. How can I tell rsync to only exclude the folder inside my root document?

1

You need to tie the directory name to the top of the tree. This is explained in the rsync man page under the section FILTER RULES.

If the pattern starts with a / then it is anchored to a particular spot in the hierarchy of files, otherwise it is matched against the end of the pathname.

So you need to use /js, for example like this:

rsync -av --exclude /js {src} {dst}

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.