• Welcome to Computer Association of SIUE - Forums.
 

tar Question

Started by Michael Kennedy, 2004-07-19T19:06:05-05:00 (Monday)

Previous topic - Next topic

Michael Kennedy

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.
"If it ain't busted, don't fix it" is a very sound principal and remains so despite the fact that I have slavishly ignored it all my life. --Douglas Adams, "Salmon of Doubt"

Guest

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

Michael Kennedy

OK, cool- I tried something very similar to that in my testing but I didn't get the exact syntax down.  Thanks.
"If it ain't busted, don't fix it" is a very sound principal and remains so despite the fact that I have slavishly ignored it all my life. --Douglas Adams, "Salmon of Doubt"