[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Unattended decompression of multiple .tgz files to a single folder



hi,

I have a dvd-data disk. Written at its top level are 300 .tgz archives.
Therefore each archive has been firstly tar'd and then gzip'd. Each of
the 300 archives contains 2 folders ("Objects" and "Terrain") and each
of these 2 folders contain a number of sub-folders.

The tgz archives on the disk are named in this fashion:
e000n00.tgz e000n10.tgz e000n20.tgz ---etc----> e170s30.tgz--and so on.

I need to figure out the command line syntax to:

1. Extract *all* tgz files on the disk to a single directory,
say /home/hankthetank/flightgear/ so that the ./flightgear directory
contains the Objects and Terrain directories with the *combined*
contents of the Objects and Terrain directories in all the tgz archives
on the disk.
wouldnt' the following do the trick?

for P in *.tgz
do
  tar xzvf $P ~/flightgear/
done

i don't think there should be any problem with adding files to existing directory.

2. The same as above except be able to define a range of tgz archives to
extract, for example, e130s20.tgz, e130s30.tgz, e130s40.tgz, and
e140s20.tgz.
if you have some regular increment,
for P in `seq 20 10 40`
do
  tar xzvf e130${P}.tgz ~/flightgear
done

if it isn't regular, just do
for P in 130s20 130s30 130s40 140s20
do
  tar xzvf e${P}.tgz ~/flightgear
done

or anything similar.

I don't care how complex the syntax is for this, as it would be a huge
time saver against a gui (obviously).
so as you can see it should be pretty simple. however, i'm not sure i got your query right.

regards,

--
Lubos _@_"
http://www.lubos.vrbka.net



Reply to: