tar backup script

Derek Ragona derek at computinginnovations.com
Thu Feb 14 15:13:22 UTC 2008

At 09:57 PM 2/13/2008, Steel City Phantom wrote:
>this isn't really bsd specific but i still need help with it.  im writing a
>backup script  a clip from that script is this:
>find /usr/local/www/data-dist/ -name config.php >
>find /usr/local/www/data-dist/ -name ClientFiles >>
>tar cvf /usr/local/backupScript/files/www-client-files.tar -I
>/usr/local/backupScript/include /usr/local/www/data-dist
>obviously im creating an include file from a directory.  when the tar runs,
>it correctly adds all the files in the include file.  but once that is
>finished, for some reason tar then goes back and adds all the files that are
>in the /usr/local/www/data-dist directory, even the ones in the include
>file.  i was under the impression that the -I command would add ONLY the
>files that are listed in the include.  why is it adding those and then after
>finishing that, adding all the others?

As you have found -I which is the same as -T will read the file, and in 
create mode add those files to the tar volume, but then the next param is 
read as another pattern to archive.  Why not do just:
tar cvf /usr/local/backupScript/files/www-client-files.tar -I


This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

More information about the freebsd-questions mailing list