Remove folder structure from archive, ignore folder while archiving and fix error
- by Michael
I am trying to make a script to backup each of my plesk hosts to individual files, I am having two problems:
I would like to remove the folder structure from archive, the tar is 3 folders deep
I am getting this error: tar: Removing leading `/' from member names
I need my archive to ignore folders named "catch" because I don't need them in my archive.
The code:
FILES=/var/www/vhosts/*
FNAME=""
for f in $FILES
do
FNAME=`basename $f`
tar cfv "/root/backup/ftp/$FNAME.tar" $f
done
Sample output:
tar: Removing leading `/' from member names
/var/www/vhosts/mydomain.com/
/var/www/vhosts/mydomain.com/conf
/var/www/vhosts/mydomain.com/etc/
/var/www/vhosts/mydomain.com/etc/group
/var/www/vhosts/mydomain.com/etc/termcap
/var/www/vhosts/mydomain.com/etc/passwd
/var/www/vhosts/mydomain.com/usr/