LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


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

Rep: Reputation: Disabled
exclude hidden files from rsync


Hi,

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/ignore.zip www@www.dev.com:"/local/myFiles/.DAV/ignore.zip"

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.



Thanks

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

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Hi!

rsync's man page says:
Code:
       --exclude=PATTERN
              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.

Hint:
Code:
--exclude='*.old'
Best regards,
HMW

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:
Code:
$ rsync -avz --exclude 'local/myFiles/.DAV' source/ destination/

Last edited by HMW; 07-29-2015 at 09:39 AM.
 
Old 07-29-2015, 11:03 AM   #3
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,784

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

Original Poster
Rep: Reputation: Disabled
@HMW

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.

@rknichols

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.

Thanks.
 
  


Reply



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 01:08 PM
How do I make find exclude hidden files (.files) Rotwang Linux - General 2 08-08-2011 03:58 AM
[SOLVED] 'find' command regex to exclude hidden files? arashi256 Linux - Newbie 3 06-28-2010 08:53 AM
help with rsync exclude files Red Squirrel Linux - Software 4 03-03-2009 10:54 AM
What files to exclude when using rsync TongueTied Linux - General 2 07-20-2006 08:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:32 PM.

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