Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 07-29-2015, 08:21 AM   #1
LQ Newbie
Registered: Jul 2015
Posts: 12

Rep: Reputation: Disabled
exclude hidden files from rsync


I am using --exclude=".DAV" to exclude .DAV folders from rsync jobs.
But .DAV folder is also copying in target path.

This is my job when I do : ps -ef | grep rsync

www 2188 1614 0 12:07 pts/4 00:00:00 /local/rsync --exclude=".DAV" --rsync-path=/local/rsync -vt --stats --progress --compress -e /usr/bin/ssh -x -p 22 --partial-dir=/local/partial --block-size=5000 --temp-dir=/local/inbound --timeout=3600 /local/myFiles/.DAV/"/local/myFiles/.DAV/"

Can you please tell me what I am wrong here? why .DAV hidden folder is not excluded.

PS: my rsync command is created from java which will check for every 15 mins for new files. If it finds any new files, then creates a rsync job.


Last edited by rayalab; 07-29-2015 at 08:41 AM.
Old 07-29-2015, 10:16 AM   #2
Registered: Aug 2013
Location: Sweden
Distribution: Debian, Arch, Red Hat, CentOS
Posts: 773
Blog Entries: 3

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369

rsync's man page says:
              This option is a simplified form of the --filter option
              that defaults to an exclude rule and does not allow the
              full rule-parsing syntax of normal filter rules.

              See the FILTER RULES section for  detailed  information
              on this option.
My guess is that is the reason you fail to exclude the .DAV files/directories.

Best regards,

Edit: Wait a minute! Maybe I misunderstood, if you simply want to exclude a SINGLE DIRECTORY, you can give the pathname to --exclude, something like this:
$ rsync -avz --exclude 'local/myFiles/.DAV' source/ destination/

Last edited by HMW; 07-29-2015 at 10:39 AM.
Old 07-29-2015, 12:03 PM   #3
Senior Member
Registered: Aug 2009
Distribution: CentOS
Posts: 4,322

Rep: Reputation: 1964Reputation: 1964Reputation: 1964Reputation: 1964Reputation: 1964Reputation: 1964Reputation: 1964Reputation: 1964Reputation: 1964Reputation: 1964Reputation: 1964
It is difficult to exclude something that you specifically asked to be included. Your command line argument "/local/myFiles/.DAV/" happens to lie within the excluded ".DAV" directory, but rsync never actually processes that directory.
Old 08-03-2015, 03:12 AM   #4
LQ Newbie
Registered: Jul 2015
Posts: 12

Original Poster
Rep: Reputation: Disabled

Thanks for your reply.
in my case, I am not excluding only one particular file. .DAV folder can be anywhere. I have to exclude all .DAV folders.


Yes You are correct. my Java already initiated rsync job for the file from .DAV folder. In this case rsync cannot do anything even I have used exclude command. Now I understood.
I stopped creating rsync jobs in java if source path contains .DAV.
now it is working.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Exclude all hidden files except a few with Grsync. linustalman Linux - Networking 10 05-10-2014 02:08 PM
How do I make find exclude hidden files (.files) Rotwang Linux - General 2 08-08-2011 04:58 AM
[SOLVED] 'find' command regex to exclude hidden files? arashi256 Linux - Newbie 3 06-28-2010 09:53 AM
help with rsync exclude files Red Squirrel Linux - Software 4 03-03-2009 11:54 AM
What files to exclude when using rsync TongueTied Linux - General 2 07-20-2006 09:39 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:13 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration