Extracting archives to same directory

Asked by Charles M. Barnard

Is there a way to:

Extract a series of archives to the same directory? (e.g. "remember" what directory things were last extracted to.)

OR

Extract a bunch of archives at once?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu file-roller Edit question
Assignee:
No assignee Edit question
Solved by:
Abdelmonam Kouka
Solved:
Last query:
Last reply:
Revision history for this message
Best Abdelmonam Kouka (abdelmonam-kouka) said :
#1

Assuming that they are all in one directory and there are no other tgz files in the directory that you don't want to extract, do this:
Code:

cd /archive/directory
for i in *.tgz; do
tar -xzvf "$i"
done

If your archives are in .zip format use:
unzip '*.zip' -d DIRECTORY

Revision history for this message
Charles M. Barnard (wizodd) said :
#2

Thanks!