Help - Search - Members - Calendar
Full Version: rsync includes/excludes issues
Linuxhelp > Support > Technical Support
slepmog
hi guys, new to the forums but reasonably experienced with linux.

I'm trying to backup files from a directory which has subdirs named with the date in the format YYYYMMDD to an rsync server on an hourly cron job. There are lots of subdirs but i only want the past weeks worth. The way i'm trying to do this is building an rsync includes file with the directories i want and excluding everything else.

#/bin/sh
date +20%y%m%d"/" -d '7 days ago' > rsync-includes
date +20%y%m%d"/" -d '6 days ago' >> rsync-includes
date +20%y%m%d"/" -d '5 days ago' >> rsync-includes
date +20%y%m%d"/" -d '4 days ago' >> rsync-includes
date +20%y%m%d"/" -d '3 days ago' >> rsync-includes
date +20%y%m%d"/" -d '2 days ago' >> rsync-includes
date +20%y%m%d"/" -d 'yesterday' >> rsync-includes
date +20%y%m%d"/" >> rsync-includes
rsync -av --include='*/' --include-from=rsync-includes --exclude='*' --delete `pwd` rsync://server/profile

This results in transferring no files. the result of cat rsync-includes is:
20071130/
20071201/
20071202/
20071203/
20071204/
20071205/
20071206/
20071207/

TIA smile.gif
slepmog
i have since upgraded to the newest version of rsync and an now using this script:
CODE
#/bin/sh
echo + `pwd`/`date +20%y%m%d"/" -d '7 days ago'` > .rsync-filter
echo + `pwd`/`date +20%y%m%d"/" -d '6 days ago'` >> .rsync-filter
echo + `pwd`/`date +20%y%m%d"/" -d '5 days ago'` >> .rsync-filter
echo + `pwd`/`date +20%y%m%d"/" -d '4 days ago'` >> .rsync-filter
echo + `pwd`/`date +20%y%m%d"/" -d '3 days ago'` >> .rsync-filter
echo + `pwd`/`date +20%y%m%d"/" -d '2 days ago'` >> .rsync-filter
echo + `pwd`/`date +20%y%m%d"/" -d 'yesterday'` >> .rsync-filter
echo + `pwd`/`date +20%y%m%d`"/" >> .rsync-filter
echo "- *" >> .rsync-filter
rsync -anvz  --filter=".rsync-filter" --delete `pwd` rsync://server4/voip


which gies a .rsync-filter file of:
CODE
+ /var/www/html/recordings/calls/20071130/
+ /var/www/html/recordings/calls/20071201/
+ /var/www/html/recordings/calls/20071202/
+ /var/www/html/recordings/calls/20071203/
+ /var/www/html/recordings/calls/20071204/
+ /var/www/html/recordings/calls/20071205/
+ /var/www/html/recordings/calls/20071206/
+ /var/www/html/recordings/calls/20071207/
- *

which according to the rsync man file, should be valid. alas i get an error of
CODE
[root@asterisk1 calls]# ./backup.sh
invalid modifier sequence at 'y' in filter rule: .rsync-filter
rsync error: syntax or usage error (code 1) at exclude.c(781) [client=2.6.8]


grr...
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2017 Invision Power Services, Inc.