LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   exclude parameter of rsync- 'dir' vs "dir" vs dir (https://www.linuxquestions.org/questions/linux-general-1/exclude-parameter-of-rsync-dir-vs-dir-vs-dir-4175410744/)

rng 06-10-2012 11:40 AM

exclude parameter of rsync- 'dir' vs "dir" vs dir
 
If I use --exclude option in rsync, what is the difference in following 3 forms?

Code:

--exclude='dirname'
--exclude="dirname"
--exclude=dirname

Is any one option preferred if I have to use * as well (eg 'dir*') ?
Thanks for your help.

pan64 06-10-2012 01:28 PM

this is probably evaluated by the shell not by rsync, so I'm not sure.










__________________________________
Happy with solution ... mark as SOLVED
If someone helps you, or you approve of what's posted, click the "Add to Reputation" button, on the left of the post.

TobiSGD 06-10-2012 01:43 PM

Strings in single quotes are not parsed by the shell, so if you use variables in your exclude string they will not be expanded.
Double quotes will allow the use of spaces in filenames, variables will be expanded by the shell, as well as globs.
using no quotes at all has the same effect as using double quotes, but filenames with spaces aren't allowed.

rng 06-10-2012 08:37 PM

Thanks.
That means * works equally well in all forms.

TobiSGD 06-10-2012 08:41 PM

No, I should have explained that in more detail. If you use single quotes the shell will not touch the string and make no expansions. This does not only apply to variables, but also to globs, like *.

rng 06-13-2012 01:47 AM

Thanks for explaining. I used it and was able to complete the process successfully without losing any data.


All times are GMT -5. The time now is 10:20 AM.