LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-01-2011, 06:54 AM   #1
Mr. Alex
Senior Member
 
Registered: May 2010
Distribution: No more Linux. Done with it.
Posts: 1,238

Rep: Reputation: Disabled
rsync "--exclude" doesn't do its job


Backup script:

Code:
rsync -vrpogt --delete --exclude=/all/.Trash-1000 --exclude=/all/lost+found /all /media/backup/ && rsync -vrpogt --delete --exclude=/home/alex/example.odt /home/alex /media/backup/ && echo -e '\e[1;34m>> All is done correctly <<'
After executing this script example.odt is copied to /media/backup/alex. What did I do wrong? I don't need it to be copied.
 
Old 03-01-2011, 07:01 AM   #2
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339

Rep: Reputation: 260Reputation: 260Reputation: 260
As you are already copying from /home/alex, what about specifying just the plain file name in the --exclude option?
 
Old 03-01-2011, 07:02 AM   #3
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Deleted wrong answer, sorry

Last edited by repo; 03-01-2011 at 07:04 AM.
 
Old 03-01-2011, 11:12 AM   #4
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Is /home/alex/example.odt copied or not deleted?

Have you tried --verbose or --verbose --verbose?
 
Old 03-01-2011, 11:25 AM   #5
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
Quote:
Originally Posted by Mr. Alex View Post
Backup script:

Code:
rsync -vrpogt --delete --exclude=/all/.Trash-1000 --exclude=/all/lost+found /all /media/backup/ && rsync -vrpogt --delete --exclude=/home/alex/example.odt /home/alex /media/backup/ && echo -e '\e[1;34m>> All is done correctly <<'
After executing this script example.odt is copied to /media/backup/alex. What did I do wrong? I don't need it to be copied.
The --exclude option uses relative paths. Rsync -vvvvvv will give you some insight into any issues you may have.

So if you have /tmp/test1 with blah and blah2 in it and want to copy to /tmp/test2/ AND if you do not want to copy blah2 you will do this:
Quote:
rsync -varh --exclude=blah2 /tmp/test1/ /tmp/test2/
In your case:

Code:
rsync -vrpogt --delete --exclude=.Trash-1000 --exclude=lost+found /all /media/backup/ && rsync -vrpogt --delete --exclude=example.odt /home/alex /media/backup/ && echo -e '\e[1;34m>> All is done correctly <<'
Also, -var will probably work for you instead of -vrpogt

Last edited by szboardstretcher; 03-01-2011 at 11:27 AM.
 
Old 03-02-2011, 05:34 AM   #6
Mr. Alex
Senior Member
 
Registered: May 2010
Distribution: No more Linux. Done with it.
Posts: 1,238

Original Poster
Rep: Reputation: Disabled
Thumbs up Solved

Thanks everyone!
The solution is to use:
Code:
rsync -vrpogt --delete --exclude=/alex/example.odt /home/alex /media/backup/
/alex/example.odt
instead of
/home/alex/example.odt

Quote:
Is /home/alex/example.odt copied or not deleted?
It was copied. And I didn't need it to be so at all.
 
  


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
Exclude "Permission denied" files for "ls -al" grob115 Linux - Newbie 3 12-03-2010 09:45 AM
Can we use exclude option in"rm" command to exclude some files/folders? yadav_rk727 Linux - Newbie 1 02-03-2010 10:14 AM
readdir() gives "." and ".." and doesn't exclude some folders Tordne Programming 12 08-13-2009 03:01 PM
Does "rm" command has a option "--exclude"? jimmyjiang Red Hat 5 02-22-2008 01:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:29 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