LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   backup folder (rsync) (https://www.linuxquestions.org/questions/linux-software-2/backup-folder-rsync-429796/)

os2 03-29-2006 06:30 PM

backup folder (rsync)
 
hi

i try to backup my home folder with rsync...

in a script i have

Code:

#!/bin/sh
# directory to backup
BDIR=/home/$USER

# excludes file - this contains a wildcard pattern per line of files to exclude
EXCLUDES=exclude.txt

OPTS="-a -r -v --exclude-from=$EXCLUDES"

# the name of the backup machine
BACKUPDIR=/tmp/test_rsync

# now the actual transfer
rsync $OPTS $BDIR $BACKUPDIR

i try to exclude some folde and all sub-directory...

in my exclude.txt i have
+ /home/collinm/mp3
+ /home/collinm/Download

when i run the script, rsync copy all file .... it copy mp3 and Download folder..... but i don't want that....

any idea?

thanks

jlinkels 03-29-2006 08:17 PM

I don't have the computer on which I have installed rsync at hand, so just two wild guesses:

1. "+" in front of a rule usually means that the path is INcluded. Now I don't know if "+" in an EXclude file means exclude, or include. Intuitively I would say that in an exclude file reverse logic is true. However, just try the path without "+" and preceeded with "-"

2. When rsync descends into directories, the rule must still be true. That means that the path /home/collinm/mp3/hardrock does NOT match the rule /home/collinm/mp3. You would have to specify the rule as /home/collinm/mp3/* Only then every subdir matches your rule.

Good luck, and sorry if I am wrong.

jlinkels

os2 03-29-2006 08:20 PM

i tried with "+", "-" and nothing and get the same result

haertig 03-29-2006 08:21 PM

An "exclude file" defaults to the "-" operation if it is not specified whereas an "include file" defaults to "+". However, you can make an exclude file behave like an include file by prefacing the lines with a "+". This is exactly what you did. The converse is also true for an include file with "-" lines in it (this would behave like an exclude file).

Do not put those "+" signs in your exclude file.

Replace:
Code:

+ /home/collinm/mp3
+ /home/collinm/Download

with this:
Code:

/home/collinm/mp3
/home/collinm/Download


os2 03-29-2006 09:07 PM

mp3/
Download/

work fine with that....


All times are GMT -5. The time now is 11:20 AM.