Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Backup files that match files in deploy tar 1

Status
Not open for further replies.

Wrathchild

Technical User
Aug 24, 2001
303
US
I would like to backup files (put them into backup.tar) on a server that match the files that are in the tar file I'm deploying. Is there a way to check if the files in the deploy.tar match the files on the server? Maybe somehow use the -tvf to check against the server files?

thanks!
 
You could extract the new tar into a separate directory and then compare each file before copying?

The simplest would just be to back up all files in the tar tf deploy.tar listing, even if they haven't been changed.

Annihilannic.
 
Well, if you just want to backup the files that will be overwritten by the [tt]deploy.tar[/tt] files (without comparing), you could do something like this...
Code:
tar tf deploy.tar | xargs tar cf backup.tar
 
thanks guys; Sam, your solution worked like a charm

thanks!
 
just for my own knowledge, can you explain why it doesn't work without xargs?
 
xargs reads standard input and runs the specified command using the input as arguments, e.g. tar cf backup.tar file1 file2 file3 .... If you don't have xargs in there you get an incomplete tar command (it won't know which files to archive).

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top