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

x
?
Solved

RSYNC exclude option problem

Posted on 2007-10-16
11
Medium Priority
?
2,063 Views
Last Modified: 2013-12-01
I am having difficulty implementing the exclude option when I run the following command:

#!/bin/bash
OPTIONS="-Cavz --delete --backup --exclude-from=/archive/01\ -\ Archived\ Files/TEST"
BACKUPDIR="/var/www/html/backup/incrementals/`date +%d-%m-%y--%a`"
rsync -e 'ssh -p 3663' $OPTIONS --backup-dir=$BACKUPDIR root@xxx.xxx.xxx.xxx:'/archive/01\ -\ Archived\ Files' /var/www/html/backup/archive

I receive a syntax error. The command works perfectly without trying to exclude a directory. Any ideas on where I'm going wrong?

Many Thanks
0
Comment
Question by:the_omnific
10 Comments
 
LVL 48

Expert Comment

by:Tintin
ID: 20091166
Try quoting $OPTIONS

rsync -e 'ssh -p 3663' "$OPTIONS"
0
 
LVL 1

Author Comment

by:the_omnific
ID: 20091324
no, it doesn't work still.

unknown option.
0
 
LVL 48

Expert Comment

by:Tintin
ID: 20091372
Hmm, try

OPTIONS="-Cavz --delete --backup --exclude-from=\"archive/01\ -\ Archived\ Files/TEST\""
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 1

Author Comment

by:the_omnific
ID: 20091393
don't you mean:

OPTIONS="-Cavz --delete --backup --exclude-from="/archive/01\ -\ Archived\ Files/TEST\""

failed to open exclude file /archive/01: no such file or directory
0
 
LVL 48

Expert Comment

by:Tintin
ID: 20091691
No, I did mean backslashes and quoting where I had it.
0
 
LVL 1

Author Comment

by:the_omnific
ID: 20091762
again, same error message

failed to open exclude file "archive/01: no such file or directory (2)
0
 
LVL 1

Author Comment

by:the_omnific
ID: 20094415
create a file called 'exclude.txt' on the local machine

define the files and folders you want to exclude from the rsync in exclude.txt

The working command is as follows:

--exclude-from '/home/backup/exclude.txt'
0
 
LVL 48

Accepted Solution

by:
Tintin earned 2000 total points
ID: 20096446
Actually, I was wrong, I removed the / before /archive01

OPTIONS="-Cavz --delete --backup --exclude-from=\"/archive/01\ -\ Archived\ Files/TEST\""

Do you actually need the exclude file in that directory?  I'm assuming not given your last post.

General rule of thumb is to avoid spaces in directory names.
0
 
LVL 3

Expert Comment

by:4dimach
ID: 20111100
OPTIONS="-Cavzn --delete --backup --exclude-from=\"/archive/01 - Archived Files/TEST\""

or

OPTIONS='-Cavzn --delete --backup --exclude-from="/tmp/01 - Archived Files/TEST"'

0
 
LVL 1

Expert Comment

by:Computer101
ID: 20521578
Forced accept.

Computer101
EE Admin
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

VM backup deduplication is a method of reducing the amount of storage space needed to save VM backups. In most organizations, VMs contain many duplicate copies of data, such as VMs deployed from the same template, VMs with the same OS, or VMs that h…
I have written articles previously comparing SARDU and YUMI.  I also included a couple of lines about Easy2boot (easy2boot.com).  I have now been using, and enjoying easy2boot as my sole multiboot utility for some years and realize that it deserves …
This tutorial will walk an individual through configuring a drive on a Windows Server 2008 to perform shadow copies in order to quickly recover deleted files and folders. Click on Start and then select Computer to view the available drives on the se…
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…
Suggested Courses

872 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