OK - I've been writing smoe backup scripts recently, but have run in to a problem... tar is archiving everything in anything 1 folder or more depth than I specifically request in the script, and not checking it's date.
That's probably not very clear, so I'll try and explain. Firstly, here's my script:
Code:
echo "Starting changes backup..."
cd /
#The following creates a .tar.gz file, named as so: yymmdd_changes.tar.gz, in the /home/backup directory.
tar -czvf /home/josh/`date +"%y%m%d"`_changes.tar.gz --after-date="`date +%F --date='yesterday'`" /home/josh/backup/addresses/* \
/home/josh/backup/diary/* \
/home/josh/docs/* \
/home/josh/img/* \
/home/josh/kde/* \
/home/josh/Mail/* \
/home/josh/pkg/* \
/home/josh/public_html/* \
/home/josh/script/* \
/home/josh/web/*
echo "Changes backup complete."
I'm trying to make it only archive files which have been changed since yesterday, to any directory depth, but this tar command will only check the dates of files in a specifically requested directory,
eg, /home/josh/docs/file.txt will be checked and acted on appropriately, but /home/josh/docs/
work/file.txt won't be checked, and will be archived regardless.
any ideas what I'm doing wrong?