LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-19-2001, 12:01 PM   #1
kennie
LQ Newbie
 
Registered: Jul 2001
Location: New Brunswick. Canada
Distribution: red hat 5.2
Posts: 8

Rep: Reputation: 0
Exclamation tar files


hi everyone..

we recently created a tar file back up of our system at work, and there's a couple of files that should not have been entered in the back up .. (it's on a weekly script.. ) and i'm wondering if theres a way to extract/delete the unwnated files in the tar file without having to extract and re tar the file latter on.

I think this is how it can be done (not !00% sure though.. i'm still learning the commands and what not)

tar tzvf filename.tar <- that should tell me what's in the file?

tar zvf filename.tar --delete files.xxx <- that should delete the unwanted files correct?

sorry if this seems a little out of place i'm a

thxs. kennie
if you can , email an answer/solution to me here k8ke3@unb.ca
 
Old 07-19-2001, 12:56 PM   #2
d3funct
Member
 
Registered: Jun 2001
Location: Centralia, WA
Posts: 274

Rep: Reputation: 31
Yes you are correct, that will work. I've just tested it on my system to make sure you had the right syntax and you do. G d Luck!
 
Old 07-19-2001, 01:42 PM   #3
kennie
LQ Newbie
 
Registered: Jul 2001
Location: New Brunswick. Canada
Distribution: red hat 5.2
Posts: 8

Original Poster
Rep: Reputation: 0
I'm back again..

is there a wildcard command? we need to delete many files of the same file type.. is that possible?

also if we know the folder that there in can we just delete that folder?

thxs again

kennie

Last edited by kennie; 07-19-2001 at 01:53 PM.
 
Old 07-19-2001, 08:00 PM   #4
d3funct
Member
 
Registered: Jun 2001
Location: Centralia, WA
Posts: 274

Rep: Reputation: 31
Say you have tarred your /home/yourname/scripts directory and in your scripts directory there are directories for perl, kornshell, cshell etc... and a tar -tvf scripts.tar shows this

rwxr-x--- user/group 1631 2001-06-01 15:37:09 scripts/perl/mon_users
-rwxrwxr-x user/group 282 2001-05-30 13:48:34 scripts/perl/pols
-rwxrwxr-x user/group 1921 2001-05-30 13:48:14 scripts/perl/dutree

I can do:
tar -vf script.tar --delete scripts/perl/dutree

or

tar -vf scripts.tar --delete scripts/perl

the first will delete my dutree script, the second will delete all my perl scripts under scripts/perl.
 
Old 07-20-2001, 06:44 AM   #5
kennie
LQ Newbie
 
Registered: Jul 2001
Location: New Brunswick. Canada
Distribution: red hat 5.2
Posts: 8

Original Poster
Rep: Reputation: 0
i'm still here - tar files

(and tired)

ok.. now that i've fought with our system all night long... i'm to the point where i'm ready to throw it out of the window....

is there any special trick to get a listing of what it in a file if its a
filename.tar.gz ?

thxs again.. kennie
 
Old 07-20-2001, 08:26 AM   #6
d3funct
Member
 
Registered: Jun 2001
Location: Centralia, WA
Posts: 274

Rep: Reputation: 31
The only trick you can do with that is to unzip it using either "gunzip foo.tar.gz" or "gzip -d foo.tar.gz" then do tar -tvf foo.tar. You can't do tar -ztvf foo.tar.gz because the tar command is looking for a valid tar file and this one is wrapped with a gzip program, so you have to unzip it first.
 
Old 07-20-2001, 09:52 AM   #7
ascii2k
Member
 
Registered: Dec 2000
Location: Indiana
Distribution: Red Hat 7.3/Mandrake 8.2/9.0
Posts: 154

Rep: Reputation: 30
Lightbulb

Actually,
You should be able to issue the command:
tar ztvf xxxx.tar.gz to see the contents of the file. I just tried it and it worked fine for me. I believe that is what the "z" option does. It can also be used to extract the files from a .tar.gz archive. i.e. tar zxfv xxxx.tar.gz will extract all the files from the xxxx archive.
 
Old 07-20-2001, 10:38 AM   #8
d3funct
Member
 
Registered: Jun 2001
Location: Centralia, WA
Posts: 274

Rep: Reputation: 31
Ascii2k,

I tried tar -ztvf foo.tar.gz and it failed for me, I can do tar -zxvf foo.tar.gz and that works fine. I dunn
 
Old 07-20-2001, 12:20 PM   #9
kennie
LQ Newbie
 
Registered: Jul 2001
Location: New Brunswick. Canada
Distribution: red hat 5.2
Posts: 8

Original Poster
Rep: Reputation: 0
eh, we tried that too here.. and it wouldn't work for us.. so we just gave up and deleted the whole tar file and created a new one without the garbage.. it's not what we really wanted to do.. but we were having slight difficulties with our system this morning...



kennie
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
a tough question 4 u, problem in extracting tar & tar.gz files p_garg Linux - General 5 11-08-2010 11:02 AM
how to install .tar.bz and src.rpms and tar.gz files gadekishore Linux - Software 1 10-12-2005 08:09 PM
How do you install tar/gz files, and rpm files? Fear58 Linux - Software 6 02-14-2004 04:35 PM
cant install .bin files, tar.gz files or anyother format!!! madskillz Linux - Newbie 4 10-05-2003 10:28 AM
Building RPM files from TAR files parle Linux - Software 3 05-05-2002 11:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:05 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration