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?

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

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.