I don't know if this will answer your questions directly, but here's what I
note with the command as you've listed it:
find $SOURCE -type d -exec tar -czvf $BACKUPDIR/{}/badkup.tar.gz
SOURCE/{}\:
1) When you use the exec portion of the find command it will call an
instance of tar for EACH file that is found. If find returns 10 files, 10
instances of tar will be called. This will cause your backup file to only
contain the last file called by exec because each time tar is called it will
overwrtie the previously saved file. To resolve this you must use the
append flag, see man tar.
2) If find returns many, many files the script will be slow because of
calling tar so many times. I would recommend using xargs to pass the files
to tar.
3) I am unclear on your need to recreate the directory structure. Tar can be
called using either relative dirs or absolute dirs. When you untar the
backup file the directory structure will be recreated automatically. What I
have done when I need to only tar selected directories is make a text file
with a list of directories. There is a flag for tar that will then read the
external file and process only those directories. There is also a flag to
do the opposite, tar everything execpt the directories listed in the
external text file. I have used a combination of these two to make a backup
script which allowed me to perform very specific directory backups.
Maintence was very simple in that I only had to maintain 2 text files - one
which listed the directories to include (ie. user's home dirs) and one which
listed which directories to exclude (i.e. /proc)
Hope this helps,
Peter
-----Original Message-----
From:
plug-discuss-admin@lists.PLUG.phoenix.az.us
[
mailto:plug-discuss-admin@lists.PLUG.phoenix.az.us]On Behalf Of Steven
M. Klass
Sent: Tuesday, June 26, 2001 9:33 AM
To: PLUG
Subject: What's wrong with this command?
Hey all,
I am working on a back-up script. I'm really into the meat of if right now
and I can't figure out how to do something. Basically my backup script will
recreate the directory structure and only tar the files in the directory.
To
recreate the directory structure I use
find $SOURCE -type d -exec mkdir $BACKUPDIR{} \;
Now for the fun part looking into each directory and and only taring the
files and symbolic links.. I'm trying variations of the above to no avail.
Here is the idea that I have been working with..
find $SOURCE -type d -exec tar -czvf $BACKUPDIR/{}/badkup.tar.gz
SOURCE/{}\:
This doesn't work. Can someone help me out here? Do I need to implement this
into a larger function?
--
Steven M. Klass
Physical Design Engineering Manager
Andigilog Inc.
7404 W. Detroit Street, Suite 100
Chandler, AZ 85226
Ph: 480-940-6200 ext. 18
Fax: 480-940-4255
sklass@andigilog.com
http://www.andigilog.com
________________________________________________
See
http://PLUG.phoenix.az.us/navigator-mail.shtml if your mail doesn't post
to the list quickly and you use Netscape to write mail.
PLUG-discuss mailing list -
PLUG-discuss@lists.PLUG.phoenix.az.us
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss