There is indeed a way. You will probably have to do some scripting, but it isn't that hard.
Lets start with a file,
file.lst, that contains all of the fully qualified file names you want to tar:
Code:
/var/log/dmesg
/usr/bin/firebird
Code:
TARFILE=/backups/backup_$(date +%G%m%d).tar
for i in $(cat file.lst)
do
DIRECTORY=$(dirname $i)
FILEN=$(basename $i)
if [ -f $TARFILE ]
then
(cd $DIRECTORY ; tar rvf $TARFILE $FILEN)
else
(cd $DIRECTORY ; tar cvf $TARFILE $FILEN)
fi
done
Something like this should do it.
The
tar cvf creates the tar file
tar rvf appends to that tar file. Doing the
cd inside of parens spawns a separate shell and when it exits you are back in the same place.
Hope this helps!