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.
  • 89,123
  • 21
  • 245
  • 323
user88349
  • 309
  • 2
  • 4
  • 10
  • 1
    possible duplicate of [rsync exclude hidden files doesnt work!](http://askubuntu.com/questions/482916/rsync-exclude-hidden-files-doesnt-work) – Ron Jun 14 '15 at 09:36

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.
  • 89,123
  • 21
  • 245
  • 323