[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Can't get cwrsync over ssh directory exclusions to work

Posted on 2009-02-17
8
Medium Priority
?
856 Views
Last Modified: 2013-12-01
Hello all-

Here's my situation-

I have remote users with laptops who are backing up data to a central location server. The laptop clients are Windows XP, a few Vista. The backup server is Windows Server 2003 standard.

On both server and client I have installed CopSSH and cwrsync from www.itefix.no

I have constructed batch files to run either manually initiated backup transfers, or to run as scheduled tasks. This all works really well. Transfer rates are great, etc. I've set up SSH key pairs so users do not have to enter passwords, and I have an exclusion list text file that lives on the server which is pulled down and referenced anew for every transfer.

The rsync command is backing up users' My Documents folder, and in the command, I have a path exclusion to leave out /My Documents/Exclude*

I have an exclusion for file size limit, one for excluding types from a text file, and one to exclude a directory within My Docs. This directory path exclusion will not work.

I've tried many many forms of the syntax, and with ones that are obviously wrong, I get syntax errors like I expect, but versions that are correct or should work, I get no errors or failures, but the exclusion simply doesn't work. It's like the command runs properly, but then ignores itself and sends the excluded directory anyway.

I have been searching the web for several weeks now to find a solution to no avail. I've seen several others online with similar issues who've gotten it to work, but none of the applied fixes worked in my setup.............

Any thoughts or ideas? Any help is greatly appreciated.
Batch File Example, commented line is the one that fails...
 
@ECHO OFF
 
SET CYGWIN=nontsec
SET CWRSYNCHOME=c:\unix\
chdir C:\unix\Bin
c:
"C:\unix\Bin\rsync" -avzr --delete username@xxx.xxx.xxx.xxx:/cygdrive/c/exclude.txt /cygdrive/c/exclude.txt
THIS LINE FAILS TO EXCLUDE THE DIRECTORY>> "C:\unix\Bin\rsync" -avzr --progress --exclude="/cygdrive/c/Documents and Settings/username/My Documents/Exclude/*" --exclude-from="/cygdrive/c/exclude.txt" --max-size=1.5MB-1 "/cygdrive/c/Documents and Settings/username/My Documents/" -e SSH username@xxx.xxx.xxx.xxx:/cygdrive/c/backup_folder
 
PAUSE
 
EXIT

Open in new window

0
Comment
Question by:scisupport
  • 4
  • 4
8 Comments
 
LVL 16

Expert Comment

by:ai_ja_nai
ID: 23668517
Add \ before spaces so that this

/cygdrive/c/Documents and Settings/username/My Documents/Exclude/*

becomes this

/cygdrive/c/Documents\ and\ Settings/username/My\ Documents/Exclude/*

If this doesn't work, remove the asterisk at the end of the path
0
 

Author Comment

by:scisupport
ID: 23681934
Hi-

Thanks for the ideas-

I had tried already with and without the asterisk.

I did try the escape character in the path as you suggested, but that still did not work. It didn't give any errors at all - the command appears to run successfully, but the exclusion just doesn't work...

Any other thoughts?

Thanks again.
0
 
LVL 16

Expert Comment

by:ai_ja_nai
ID: 23682099
what if you simply use --exclude-from option alone?
0
Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

 

Author Comment

by:scisupport
ID: 23682590
Just using the --exclude-from=exclude.txt works for files. Any file types that are listed there are not transferred- *.exe, *.msi, etc.

I tried adding the directory path to exclude to that text file, and removed the

--exclude=/directory/path/

 line from the batch file.

This didn't work either....

0
 
LVL 16

Expert Comment

by:ai_ja_nai
ID: 23683357
the entries in your file exclusion file (awful word play) shoud look like the snippet attached.

anyway, this

--exclude=/directory/path/

should be this

--exclude='/directory/path/'

and not this

--exclude="/directory/path/"
somefile
somedir/file.*
dir/dir/*

Open in new window

0
 

Author Comment

by:scisupport
ID: 23683673
I definitely appreciate your help.

But that didn't work either...

This is why I posted to EE. I've been doing as much reading about it as I could find, and it <i>should</i> work. But it doesn't. I get no error codes or anything.

Anyway, the exclusion file types in the text file DO work. I've tested that successfully. Using File Size exclusions works, etc.

Just excluding the directory by path path refuses to work.
Could it have anything to do with the -avzr switches? I didn't think any of those would prevent a child directory exclusion...

Thanks again for your help.
0
 
LVL 16

Accepted Solution

by:
ai_ja_nai earned 2000 total points
ID: 23684377
Don't think so. By the way, -r is useless because -a already includes it (actually, -a is -rlptgoD)
Have a look at this if it can help you, particularly the comments (http://articles.slicehost.com/2007/10/10/rsync-exclude-files-and-folders): it seems is a bug
0
 

Author Comment

by:scisupport
ID: 23684684
Hi-

Yeah, I realized through enough reading of man pages and articles that 'r' was inherent in 'a', I just hadn't taken it out yet as I was mired in this exlusions thing...

In any event, this worked!

What was messing me up was this part: "Note: the directory path is relative to the folder you are backing up."

So since I was backing up the My Docs folder, and the excluded directory was there, all I had to do was add the directory name to the exclude.txt file rsync was reading from.

So now, all exclusion can live in that one text file, which is pulled newly from the server for each backup. Now allows a lot of control over what we are backing up.

Great news!

Thanks again for your help. This really gets me out of a bind.
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft will be releasing the Windows 10 Creators Update in just a matter of weeks. Are you prepared? Follow these steps to ensure everything goes smoothly and you don't lose valuable data on your PC.
This article shows how to use a free utility called 'Parkdale' to easily test the performance and benchmark any Hard Drive(s) installed in your computer. We also look at RAM Disks and their speed comparisons.
This tutorial will walk an individual through the process of installing the necessary services and then configuring a Windows Server 2012 system as an iSCSI target. To install the necessary roles, go to Server Manager, and select Add Roles and Featu…
This Micro Tutorial will teach you how to reformat your flash drive. Sometimes your flash drive may have issues carrying files so this will completely restore it to manufacturing settings. Make sure to backup all files before reformatting. This w…
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question