Computer Association of SIUE - Forums

CAOS Supported Groups => LUUCS => Topic started by: Michael Kennedy on 2004-07-19T19:06:05-05:00 (Monday)

Title: tar Question
Post by: Michael Kennedy on 2004-07-19T19:06:05-05:00 (Monday)
I'm unable to figure out how to easily do this.  I'm interested in extracting all image files from a tar file.  I'd like to be able to do something like this:

tar -x the_file.tar -type=*.jpeg *.jpg *.gif ...  

or whatever.  Any suggestions?  I write a quick script to do that for me, but I'd like to know if tar can do that for me easier than my method.

Thanks.
Title: Re: tar Question
Post by: Guest on 2004-07-19T20:16:29-05:00 (Monday)
get rid of "-type=" and you have your answer.  example:


bill:~/tmp billyc$ tar cvf archive.tar file*
file1.jpg
file2.txt
file3.gif
file4.txt
file5.jpg
bill:~/tmp billyc$ tar xvf archive.tar *.jpg *.gif
file1.jpg
file3.gif
file5.jpg
Title: Re: tar Question
Post by: Michael Kennedy on 2004-07-19T20:22:22-05:00 (Monday)
OK, cool- I tried something very similar to that in my testing but I didn't get the exact syntax down.  Thanks.