Operating System - HP-UX
1832666 Members
3161 Online
110043 Solutions
New Discussion

Re: Backup command needed

 
ng_7
Regular Advisor

Backup command needed

Hi, my dear friends,

Please give me command
1. to tar or backup more than 1 file or
directory.
eg : in /abc
there is /abc1,abc2,abc3 subdirecorty
what is the backup command to
backup /abc1 and /abc2 ?

2. to tar or fbackup for a range of file.
eg : in /abc there is all *.dbf file.
I want to specify to backup a*.dbf to
k*.dbf, may I know how to do that ?


thank you very much

regards
ng
2 REPLIES 2
A. Clay Stephenson
Acclaimed Contributor

Re: Backup command needed

Tar will accept multiple backup targets. If the target is a file, a file will be backed up. If the target is a directory, a directory will be backed up recursively.

tar cvf myarchivefile.tar myfile1 myfile2 /abcdir1 /adcdir2


The vanilla version of tar doesn't understand wildcards but the shell does so:

tar cvf /dev/rmt/1m [a-k]*.dbf

Of course, you could have tried the radical approach of "man tar".

If it ain't broke, I can fix that.
Dennis Handly
Acclaimed Contributor

Re: Backup command needed

If you need to back up multiple directories and each be relative, you can use:
$ tar -cvf myarchivefile.tar -C /abc1 . -C /abc2 .