Re: Tar archive problems.

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Dale Farnsworth
Date:  
To: nathan, PLUG-discuss
Subject: Re: Tar archive problems.
Nathan wrote:
>
> I have a set of files that are lists of files in my filesystem. I run backups
> against these scripts doing something like this...
>
> #!/bin/bash
> copy_contents() {
> (tar -cpf - "$i" | tar -f - -xpC /tmp/filearchive.1)
> }
>
> while read i ; do
>       if ! [ -d "$i" -a -e "$i" ]; then
>          copy_contents 1>/dev/null 2>/dev/null
>       fi
>       done < file_list.1

>
> It works great, but I have several empty directories that are not backed up,
> but I would like them to be backed up as files go in them temporarily, but I
> have to manually add those empty directories. How can I do the above but
> include the empty directories?


I'd use:

while read i
do
    cp -ax "$i" /tmp/filearchive.1
done < file_list.1


You may not want the -x option to cp.

-Dale
---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss