I am trying to backup my system..
I started out by trying to write a script like this:
find $DIR_LIST -newer $LAST_BU_FILENAME -type f -print > /tmp/filez.list
sed 's/ /\\ /g' /tmp/filez.list >/tmp/filez2.list
#create the initial tar file.. then we'll append to this
tar cvf fred.tar /tmp/filez2.list
for FILETOARCHIVE in $LIST
tar rvf fred.tar $FILETOARCHIVE
This would work if it wasn't for windows weenies. Windows weenies use my linux system as a file server and hence have whitespace in their files (and directories)
But it isn't the tarring that's the problem since i can do this:
tar rvf fred.tar /home/fred/hello\ world/smeg.doc
and it works no problems..
so my problem is in the for loop declaration
it is giving the wrong names to the tar line
hence i need a way to send a complete line (spaces or no spaces) from $LIST to the for expression without it thinking I am specifying a new variable because of the space
Let me try and explain a bit better:
the filez2.list may look like this:
the for loop does this
sends /home/tig/rhosts to tar
sends /home/tig/hello to tar
sends world.doc to tar
which is wrong!
(i'm pretty sure what i say is correct)
the "for" expression (as soon as it hits a space) executes the loop.
basically what i need is this:
some way to do a find on my system for updated files (as above) and direct that output into tar
can i do something like this:
find $DIR_LIST -newer $LAST_BU_FILENAME -type f -print | tar rvf fred.tar -
how can this problem be solved?
or can i somehow work around the for loop problem..