Remove folder structure from archive, ignore folder while archiving and fix error
Posted
by
Michael
on Super User
See other posts from Super User
or by Michael
Published on 2013-10-19T08:24:52Z
Indexed on
2013/10/20
21:58 UTC
Read the original article
Hit count: 158
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/
© Super User or respective owner