Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to untar all tar files in current directory using Putty

Tags:

bash

tar

How can I untar all tar files in one command using Putty.

I Tried the following but its not un-tarring (all files start with alcatelS*)

 tar -xfv alcatelS*.tar

It is not working i don't get no errors and it is not un-tarring. Thank you,

like image 831
yesco1 Avatar asked Dec 14 '22 20:12

yesco1


1 Answers

-xfv is wrong since v is being referred as the file instead. Also, tar can't accept multiple files to extract at once. Perhaps -M can be used but it's a little stubborn when I tried it. Also, it would be difficult to pass multiple arguments that were extracted from pathname expansion i.e. you have to do tar -xvM -f file1.tar -f file2.tar.

Do this instead:

for F in alcatelS*.tar; do
    tar -xvf "$F" 
done

Or one-line: (EDIT: Sorry that -is- a "one"-liner but I find that not technically a real one-liner, just a condensed one so I should haven't referred to that as a one-liner. Avoid the wrong convention.)

for F in alcatelS*.tar; do tar -xvf "$F"; done
like image 107
konsolebox Avatar answered Jan 13 '23 14:01

konsolebox