LinuxQuestions.org
Help answer threads with 0 replies.
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-14-2011, 10:23 AM   #1
Russell P
LQ Newbie
 
Registered: Jul 2011
Posts: 2

Rep: Reputation: Disabled
Rsync deleting files from destination directory


Hi all, I'm new here so I'm sorry if I posted this in the wrong place, but I was hoping someone might be able to help me out with this problem we've been having with rsync.

We have an rsync cron job set up to mirror all the files in a "..\das\htdocs\docs" folder to the same folder on another server. It copies all the files over correctly and deletes any files in the "docs" directory that aren't in the sending directory, but it also deletes any files we put in the target directory's parent folder (..\das\htdocs\ or other subfolders like ..\das\htdocs\images) even though they've been excluded in the .rsync-filter file.

Here's our current rsync .sh:
/usr/local/bin/rsync --stats -qPzrtpl --delete --password-file=/var/run/.appprodrsync --log-file=/export/home
/webuser/logs/rsync-extranet-log -FF /export/home/ appprodrsync@appprod::dprweb_extranet/ > /export/home/webuser/logs/rsync-extranet-output 2>&1

Here's the filter rules we're using:
+ /das
+ /em
+ /enf
- /*

+ /*/htdocs
- /*/*

+ /*/htdocs/docs
- /*/htdocs/*

So for example server A has ..\das\htdocs\docs and ..\das\htdocs\images. Server B has ..\das\htdocs\docs but if I manually copy the images folder over to ..\das\htdocs\images, the images folder gets deleted from the target directory every time rsync runs.

A: ..\das\htdocs\docs
..\das\htdocs\images
B: ..\das\htdocs\docs\
..\das\htdocs\images (<-- gets deleted everytime rsync runs)

I'd like to keep just the docs directory synched and update other folders manually, but they keep getting deleted. It looks to me like it's running a delete-excluded option, but that option wasn't used.

Any idea what I'm doing wrong and how I can fix it?

Thanks
- Russell
 
Old 07-14-2011, 10:59 AM   #2
John VV
Guru
 
Registered: Aug 2005
Posts: 12,916

Rep: Reputation: 1715Reputation: 1715Reputation: 1715Reputation: 1715Reputation: 1715Reputation: 1715Reputation: 1715Reputation: 1715Reputation: 1715Reputation: 1715Reputation: 1715
read the man page
Code:
man rsync
Quote:
/usr/local/bin/rsync --stats -qPzrtpl --delete --password-file=/var/run/.appprodrsync --log-file=/export/home
you are USING the delete option in your command so yes it will delete the old files
 
Old 07-14-2011, 11:07 AM   #3
Russell P
LQ Newbie
 
Registered: Jul 2011
Posts: 2

Original Poster
Rep: Reputation: Disabled
I did read the man page. But it's deleting files that are excluded. My understanding was that if a directory was excluded it would not delete those files unless the delete-exclude option was used.

EDIT: Specifically the --delete option is used to keep extraneous files out of the "docs" directory, not delete files and folders outside the docs directory.

Last edited by Russell P; 07-14-2011 at 11:20 AM.
 
  


Reply


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] Files seem to take up more space in destination after rsync copy Karderio Linux - Newbie 5 02-24-2012 08:30 PM
[SOLVED] Deleting all files from a directory except for two nonshatter Linux - Newbie 2 11-25-2010 08:57 AM
What parameter do I add to RSYNC to update modified or new files to the destination? tankman1989 Linux - Software 2 02-20-2010 06:20 PM
Changing permissions of destination directory after rsync cliff123 Linux - General 1 12-26-2007 03:09 AM
how to remove a symlink without deleting the destination directory Snerkel Linux - Software 3 01-20-2005 11:47 AM


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