I want to make a backup of a directory that contains thousands of sub-directories and deep sub-folder paths. In many of these directories there are a big number of files starting with .. I want to make sure that all of the . files in sub-directories and sub-sub-directories and etc. get properly copied. Is it enough to specify include="*"? Will this cover everything?

rsync -rvh --compress-level=0 --stats --progress --include ".*"  user@vm:/mnt/storage8/backups ~/data/backup_of_backups/

All files are included by default, so if you want to include all files, don't pass any --include or --exclude option.

If you do use patterns, rsync doesn't treat dot files specially. If you wanted to skip dot files, you'd have to explicitly use --exclude='.*'.

Note that --include='.*' would only include dot files. This is a shell pattern, where . stands for itself and * means “any sequence of characters”, not a regex where . means “any character” and * means “any number of the preceding character or group”. Without any exclude directive, you still get all files, so an include directive is just pointless, but if you had some exclude directives, --include='.*' would not mean “include all files including dot files”, it would only mean “include dot files” (and on its own it wouldn't recurse into directories whose name don't start with a dot).


Without specifying any inclusion or exclusion patterns, rsync will copy hidden files and directories.

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.