tar files


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers tar files
# 1  
Old 11-12-2002
tar files

Hey all Smilie

I've got a tar file. In this tar file is heaps of stuff. Also including full directories.
Now though some of the files in that tar file have changed. So what I would like to do is to replace those files then tar it all up again. BUT I want to do this in a temp directpry cause some of these files are system files for anything configuration.

Is there a way that I can replace a file in a tar file?

or

Untar the tar file in a tmp directory? (I can't get that to work without it placing files back in there directory which I don't want) replace the files I have to, then tar it back up again. But when I tar it up again it'll keep the same structure including the directories?


Thx for any help!
merlin
# 2  
Old 11-12-2002
I don't think there is any option in tar to replace files which have been modified since they were last written in the archive.

Although there is an option "u" which will let you do the other way, i.e., to add a file if it is not already present or has been modified since it was last written in the archive.

Though you can overwrite the whole of the archive with the existing directory structure using the c option.

I would like to see if there are any simple solutions to this.

Cheers!
Vishnu.
# 3  
Old 11-12-2002
I see the same limitations with my copy of tar (GNU Tar)...
You could probably script something together that would allow you to find the modifications (using the "-d" option), then append (using "-r"), but that would do the same as "-u", update.

In that case it simply appends the changed files on the end of the archive, but does not delete the first version(s) from the archive...

Also, I'm assuming you're using the "-P" option to preserve the leading / on filenames... if not, you may be able to extract to another filesystem/directory. You can use the "-t" option to list out the files to make sure... Then, you could unpack, compare and update, then repack...

Have you though about using a different backup strategy, such as "dump" (if it's available to you - what Unix are you using?)
# 4  
Old 11-13-2002
Ok maybe I should have explained a little of what I'm doing. Sorry my mistake.

LivinFree, As the above says my mistake. It's not for a backup so dump wouldn't be an option.


This is what the CD is used for, anauto install CD for their software for the customer.

So I've created a simple little script and one huge tar file with all the files and even directories if needed. When the script is run teh files and directories are done and everyting works fine providing I tar'ed it all up right.

But now I have come across A problem. But now with updates to the software and only a few little files changed he doesn't want to go through all the stuff I do now to update a CD. cause at this time I have to untar it all then replace the files and tar it all up again. Well now I also know of a few more patches that will happen later on.

So I was just wondering if there was a way I could update the files in the tar without having to untar the file.

Ok yes I know I might have to untar the file, BUT is there a way I can untar the file in the /tmp keeping the locations of the directories BUT NOT putting them in there. So the /etc/hosts file for example would be shown from the tar file when untared as /tmp/etc/hosts. But when I replace the files and tar it back up I don't want to tar up the /tmp directory, I still want it to untar when it's from the CD and replace the old system files with the new ones and the files our software uses.

Smilie
merlin
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to create zip/gz/tar files for if the files are older than particular days in UNIX or Linux?

I need a script file for backup (zip or tar or gz) of old log files in our unix server (causing the space problem). Could you please help me to create the zip or gz files for each log files in current directory and sub-directories also? I found one command which is to create gz file for the... (4 Replies)
Discussion started by: Mallikgm
4 Replies

2. Solaris

Command to remove existing files in the tar files in Solaris 10

Hi, I am using solaris 10 OS.Please help me out with the commands needed in below two scenarios. 1)How to delete the existing files in the tar file. suppose i have a main tarfile named application.tar and it contains a file called ingres.tar. what is the command to remove ingres.tar... (2 Replies)
Discussion started by: muraliinfy04
2 Replies

3. UNIX for Dummies Questions & Answers

How to tar all files except logs and .txt files

Hi I greatly appreciate the forum and the people here very helpful :) I could able to tar all the directories, sub dirs and the files. But unable to tar all the directories excluding the log and text files. Can anyone please advise the exact command to use for excluding .log and .txt? PS:... (4 Replies)
Discussion started by: Olivia
4 Replies

4. Shell Programming and Scripting

tar command to explore multiple layers of tar and tar.gz files

Hi all, I have a tar file and inside that tar file is a folder with additional tar.gz files. What I want to do is look inside the first tar file and then find the second tar file I'm looking for, look inside that tar.gz file to find a certain directory. I'm encountering issues by trying to... (1 Reply)
Discussion started by: bashnewbee
1 Replies

5. Shell Programming and Scripting

How to tar .gz files?

I have the gzip utility installed on machine and now i am compressing the files using gzip command. i need to archive the .gz files using the tar command, but i get the command 'tar' is not recognized as an internal or external command, operable program or batch file. do i need to install the... (3 Replies)
Discussion started by: Codesearcher
3 Replies

6. UNIX for Dummies Questions & Answers

tar -cvf test.tar `find . -mtime -1 -type f` only tar 1 file

Hi all, 4 files are returned when i issue 'find . -mtime -1 -type f -ls'. ./ora_475244.aud ./ora_671958.aud ./ora_934052.aud ./ora_934050.aud However, when I issued the below command: tar -cvf test.tar `find . -mtime -1 -type f`, the tar file only contains the 1st file -... (2 Replies)
Discussion started by: ahSher
2 Replies

7. UNIX for Advanced & Expert Users

How to create a Tar of multiple Files in Unix and FTP the tar to Windows.

Hi, On my Unix Server in my directory, I have 70 files distributed in the following directories (which have several other files too). These files include C Source Files, Shell Script Source Files, Binary Files, Object Files. a) /usr/users/oracle/bin b) /usr/users/oracle... (1 Reply)
Discussion started by: marconi
1 Replies

8. UNIX for Dummies Questions & Answers

.tar.tar files

I downloaded what I thought was a gziped file (at least on remote server it had a .gz extention) and once I had it it was filename.tar.tar..I tried the standard untar tar -xvf filename on it and get an error. Does anyone know what's going on? (5 Replies)
Discussion started by: capeme
5 Replies

9. Shell Programming and Scripting

How to process the files using .tar.gz files in script

Hi, I have some file in /users/xyz directoty with .tar.gz extension. i need to find these files and if found in need to run other commands. I now the command for finding files,but how to put if condition ?please help me Thanks (3 Replies)
Discussion started by: bmkreddy
3 Replies

10. UNIX for Advanced & Expert Users

Untaring *.tar.tar files

Hi all, How to untar a file with .tar.tar extension. A utility that i downloaded from net had this extension. Thanks in advance, bubeshj. (6 Replies)
Discussion started by: bubeshj
6 Replies
Login or Register to Ask a Question