You are not logged in.

#1 2006-08-29 19:49:37

detto
Member
Registered: 2006-01-23
Posts: 510

extracting many files the easy way

how can i extract maaaaaaany archive files that are all stored in one folder? i tried with

tar xjf *.tar.bz2

and

tar xzf *.tar.gz

but that didnt work :?
is there some way to achieve this :?:
thx in advance,

cheers,
detto

Offline

#2 2006-08-29 19:51:09

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: extracting many files the easy way

for f in *.tar.bz2; do tar xzf $f; done

for f in *.tar.gz; do tar xzf $f; done

Offline

#3 2006-08-29 20:01:04

detto
Member
Registered: 2006-01-23
Posts: 510

Re: extracting many files the easy way

phrakture wrote:
for f in *.tar.bz2; do tar xzf $f; done

for f in *.tar.gz; do tar xzf $f; done

woah! thank u this works.
just one small problem i got with archves that got spaces, %20's lol those one dont want to :?

Offline

#4 2006-08-29 20:06:50

allucid
Member
Registered: 2006-01-06
Posts: 259

Re: extracting many files the easy way

try putting double quotes around $f like this: "$f"

Offline

#5 2006-08-29 20:11:38

detto
Member
Registered: 2006-01-23
Posts: 510

Re: extracting many files the easy way

allucid wrote:

try putting double quotes around $f like this: "$f"

dude :shock: thank u very much, without help i would have seen me trying out the weirdest possibilities without luck roll ... very appreciate this quick help, thx!

cheers,
detto

Offline

#6 2006-08-29 20:33:26

elasticdog
Member
From: Washington, USA
Registered: 2005-05-02
Posts: 995
Website

Re: extracting many files the easy way

Yarrr...I would have gone with find:

find . -name "*.tar.bz2" -exec tar xzf {} ;

Offline

#7 2006-08-29 21:17:09

brazzmonkey
Member
From: between keyboard and chair
Registered: 2006-03-16
Posts: 818

Re: extracting many files the easy way

don't take it bad, but in kde ark would have done it with a mouse click...


what goes up must come down

Offline

#8 2006-08-29 21:48:48

detto
Member
Registered: 2006-01-23
Posts: 510

Re: extracting many files the easy way

brazzmonkey wrote:

don't take it bad, but in kde ark would have done it with a mouse click...

woop, really?! roll tell me how plz. have kde installed on nother computer smile

Offline

#9 2006-08-29 22:00:33

smoon
Member
Registered: 2005-08-22
Posts: 468
Website

Re: extracting many files the easy way

elasticdog wrote:

Yarrr...I would have gone with find:

find . -name "*.tar.bz2" -exec tar xzf {} ;

Heh, I got another one:

ls *.tar.bz2 | xargs -n1 tar xfz

Offline

#10 2006-08-29 22:24:11

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: extracting many files the easy way

I win for spawning less processes.

Offline

#11 2006-08-29 22:41:44

smoon
Member
Registered: 2005-08-22
Posts: 468
Website

Re: extracting many files the easy way

phrakture wrote:

I win for spawning less processes.

Yeah, but elasticdog wins for providing a solution that works even if you have a few thousand .tar.bz2 archives to extract (not sure what the exact maximum length for the argument list in bash or zsh are).

Offline

#12 2006-08-29 23:21:46

brazzmonkey
Member
From: between keyboard and chair
Registered: 2006-03-16
Posts: 818

Re: extracting many files the easy way

detto wrote:
brazzmonkey wrote:

don't take it bad, but in kde ark would have done it with a mouse click...

woop, really?! roll tell me how plz. have kde installed on nother computer smile

in konqueror, select the archive files, right-click > Extract > Extract [here ; to subfolders ; to...], and wait.
alright : one click to select, one right click, one to choose extract [...]
that's 3 clicks actually, not one. sometimes mouse is just easier...


what goes up must come down

Offline

#13 2006-08-30 00:46:07

elasticdog
Member
From: Washington, USA
Registered: 2005-05-02
Posts: 995
Website

Re: extracting many files the easy way

phrakture wrote:

I win for spawning less processes.

LOL...now all we have to do is fill this thread with dozens of variations on doing the same thing.  Three down...millions to go?!?  big_smile

Offline

#14 2006-08-30 00:59:21

T-Dawg
Forum Fellow
From: Charlotte, NC
Registered: 2005-01-29
Posts: 2,736

Re: extracting many files the easy way

I win for losing.

Offline

Board footer

Powered by FluxBB