rsync exclude hidden files doesnt work!
I’ve searched all over the internet and everybody suggests the same thing - that adding --exclude=´.*´
should exclude hidden files and folders from an rsync. It doesn’t. I´ve also tried adding a slash and/or double quotes eg. --exclude=¨\.*¨
Nothing seems to work. AGH!! Would really appreciate some help.
Solution 1:
Both versions you are showing are wrong. You need to use double quotes. The following works and excludes hidden files and directories:
--exclude=".*"
If you only want to exclude hidden directories:
--exclude=".*/"
Solution 2:
I use this expression: --exclude=".[!.]*"
Does the job well for me excluding hidden files and directories.
Solution 3:
Open a text file exclude_me.txt
and type the following: .[a-z]*
Then execute the following:
rsync -avh --exclude-from='exclude_me.txt' /path/of/Source /path/of/Destination