LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices

Reply
 
Search this Thread
Old 01-15-2011, 07:59 AM   #1
phantom630
LQ Newbie
 
Registered: Nov 2005
Distribution: Ubuntu Lucid Lynx
Posts: 5

Rep: Reputation: 0
an rsync question


hello all,

i am using rsync to backup my shell scripts for some time. i just checked the backup destinations and noticed that deleted files at the source still exist at the destination.

my rsync command is;
Code:
rsync -avz --delete --recursive /home/user/*sh /backup
i created a dummy .sh file, backed it up by the above command, then deleted it and re-run the command. rsync does not delete the dummy .sh file at the destination!

obviously i am doing something wrong, can you please help me find it?
 
Old 01-15-2011, 08:45 AM   #2
fordeck
Member
 
Registered: Oct 2006
Location: Utah
Posts: 520

Rep: Reputation: 61
I wonder if it could be a permissions issue. I tried running the same command only to another directory in my own home directory and it deletes the file as you would expect. You might check permissions for the user on /backup directory.

Regards,

Fordeck
 
Old 01-15-2011, 09:07 AM   #3
phantom630
LQ Newbie
 
Registered: Nov 2005
Distribution: Ubuntu Lucid Lynx
Posts: 5

Original Poster
Rep: Reputation: 0
thanks for your reply, fordeck.

i am running the command as root. unfortunately no permissions issue.

my OS is Ubuntu Lucid Lynx. very strange that your command runs proper, mine does not delete the originally deleted files
 
Old 01-15-2011, 10:28 AM   #4
fordeck
Member
 
Registered: Oct 2006
Location: Utah
Posts: 520

Rep: Reputation: 61
Actually when I tried it I did not use a wildcard match (i.e. /home/user/*sh). In other words I just used:

Code:
rsync -avz --delete --recursive testing/ testing2/
The above worked, however when I did:

Code:
rsync -avz --delete --recursive testing/*sh testing2/
it would no longer delete files on the destination side.

The man page has the following section related to --delete:
Quote:
You must have asked rsync to send the whole directory (e.g. "dir" or "dir/") without using a wildcard for the directory’s contents (e.g. "dir/*") since the wildcard is expanded by the shell and rsync thus gets a request to transfer individual files, not the files’ parent directory.
Regards,

Fordeck
 
Old 01-15-2011, 10:56 AM   #5
phantom630
LQ Newbie
 
Registered: Nov 2005
Distribution: Ubuntu Lucid Lynx
Posts: 5

Original Poster
Rep: Reputation: 0
hello fordeck,

yes the problem seems the wildcard pattern.

however, it is interesting that rsync being so versatile, i can not run it with a pseudo command like: synchronize all *sh files between source & destination directories, source being master and destination being slave.

rsync only performs file copy from source to destination when source is a wildcard pattern

i believe i am missing something with such a highly configurable program like rsync!

regards,
 
Old 01-16-2011, 10:02 AM   #6
fordeck
Member
 
Registered: Oct 2006
Location: Utah
Posts: 520

Rep: Reputation: 61
Your right rsync being as configurable as it is should be able to do what you are asking. I believe this may be one way to accomplish your task, however you may want to add -n to do a dry run first:

Code:
rsync -avz --delete --include '*sh' --exclude '*' /home/user/ /backup/
I hope this helps,

Fordeck
 
Old 01-16-2011, 06:04 PM   #7
phantom630
LQ Newbie
 
Registered: Nov 2005
Distribution: Ubuntu Lucid Lynx
Posts: 5

Original Poster
Rep: Reputation: 0
Works!

dear fordeck,

thank you for your support, now rsync works just the way i wanted!

i deployed the include & exclude filters. however, one should pay attention to adding character "/" to the end of source and destination dirs; since omitting / directs rsync in a wrong way.

hope this thread helps others messing with rsync

regards,
 
  


Reply

Tags
filter, rsync, synchronization


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
RSync Question JeffC1 Linux - Software 1 08-25-2008 09:14 PM
rsync question mokku Linux - Newbie 1 05-31-2008 08:56 AM
rsync question mahmoud Linux - Software 5 04-25-2008 05:13 AM
Rsync question Fill Linux - Newbie 2 10-01-2007 04:30 PM
Question about rsync bgriesi Linux - Networking 4 12-31-2004 08:19 AM


All times are GMT -5. The time now is 07:17 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration