Robert Parker
2009-Apr-15 20:26 UTC
Using rsync for a backup program but having trouble getting --exclude-from to work properly
Reading and re-reading the man page has got me nowhere with this issue and searching your site on '--exclude-from' got me to the same place. Here is the script I am using: #################################### #/bin/bash suffix=`date +%Y%m%d` echo Suffix is "$suffix" fromdir=/home/bob/ echo Source dir is "$fromdir" todir="$maxtor6"BackupOfHome excl="$fromdir".dobackup.excl echo Exclusions file is "$excl" echo Destination dir is "$todir" rsync --exclude-from="$excl" -a -b -vv --suffix="$suffix" $fromdir $todir exit 0 ######################## Here is the content of the exclude file # .dobackup.excl - list of exclusions from rsync backup /home/bob/.mozilla/firefox/ /home/bob/Ebooks.desktop /home/bob/Office.desktop /home/bob/Pictures.desktop /home/bob/Programs.desktop The command I use: ./dobackup.sh > list Partial content of list Suffix is 20090416 Source dir is /home/bob/ Exclusions file is /home/bob/.dobackup.excl Destination dir is /media/disk-4/BackupOfHome sending incremental file list delta-transmission disabled for local transfer or --whole-file <snippage> .xsession-errors Bookmarks 2009-04-11.json is uptodate Ebooks.desktop # rubbish that I don't want in the backup Index.pdf is uptodate Names.pdf is uptodate Office.desktop # rubbish that I don't want in the backup ParrotSecrets.pdf is uptodate Pictures.desktop # rubbish that I don't want in the backup Programs.desktop # rubbish that I don't want in the backup Qantas.wmv is uptodate ThaiAlphabet.ods is uptodate <snippage> .mozilla/firefox/ # and I want none of this directory at all .mozilla/firefox/profiles.ini .mozilla/firefox/28l3cgx4.default/ .mozilla/firefox/28l3cgx4.default/.parentlock .mozilla/firefox/28l3cgx4.default/XPC.mfasl .mozilla/firefox/28l3cgx4.default/XUL.mfasl .mozilla/firefox/28l3cgx4.default/blocklist.xml .mozilla/firefox/28l3cgx4.default/bookmarks.html .mozilla/firefox/28l3cgx4.default/cert8.db <snipped the rest> The system I am using is eeebuntu 8.10 on a eeePc 701 if that has any bearing on anything. I'm probably just misreading something. Thanks, Bob Parker -- In a world without walls who needs Windows (or Gates)? Try Linux instead!
Paul Slootman
2009-Apr-16 09:33 UTC
Using rsync for a backup program but having trouble getting --exclude-from to work properly
On Thu 16 Apr 2009, Robert Parker wrote:> fromdir=/home/bob/ > rsync --exclude-from="$excl" -a -b -vv --suffix="$suffix" $fromdir $todir> Here is the content of the exclude file > > /home/bob/.mozilla/firefox/If you're passing /home/bob/ as the source dir, then you have to remove /home/bob from the exclude patterns as those patterns are relative to the transfer source. I.e. /home/bob/.mozilla/firefox/ etc. becomes /.mozilla/firefox/ /Ebooks.desktop /Office.desktop /Pictures.desktop /Programs.desktop Paul
ɹןʇnqן
2009-Apr-16 09:40 UTC
Using rsync for a backup program but having trouble getting --exclude-from to work properly
On 15-Apr-2009, at 14:19, Robert Parker wrote:> rsync --exclude-from="$excl" -a -b -vv --suffix="$suffix" $fromdir > $todir> /home/bob/.mozilla/firefox/The / in the exclude-from is relative to the starting directory, not an absolute path. So what you are excluding is '$fromdir/home/ bob/.mozilla/firefox/'. -- Gentlemen, you can't fight in here! This is the War Room.