0

I want to sync all files and folders in my home directory expect for the ones that start with .

This is what I have done so far:

rsync -azPnv --delete /home/USER/ DESTINATION

In order to ignore hidden files, I guess that I have to utilize --exclude and --include as well but I am not sure how. Any ideas?

A.B.
  • 92,125
user88349
  • 309

1 Answers1

0

You can use this --exclude parameter to ignore files and folders. For hidden files and folders (filename or folder name starts with a .) use the parameter below:

--exclude "**/.*"

This means, match all files and folders which starts with a . in all folders recursively.

  • The glob ** will recursively match all files and directories
  • * will match any number of characters

More infos about pathname expansion (globbing)

From man rsync

--exclude=PATTERN
      exclude files matching PATTERN
A.B.
  • 92,125