Re: [THANKS] Unattended decompression of multiple .tgz files to a single folder
On Thu, 2006-08-24 at 07:55 +0200, Lubos Vrbka wrote:
> 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
>
>
A while back I posted a query about how to unpack multiple .tgz's to a
single directory. Lubos (above) was kind enough to reply and kinder
still to work with me off-list. He suggested a script, and when I
stuffed up the syntax, he explained that to me as well. In the end, I
went with putting all the map data for a particular continent into a
folder along with script (from Lubos) with a tar zxvfC argument,
pointing the output to a set directory, and then writing that directory
to optical disk. The C argument was what I needed to create new
subfolders on the fly. Now I just go
ksh /mnt/cdrom/europe/scenery-extractor.shell
Again, this was scenery data for the flightgear flight simulator.
Much thanks to Lubos and to the list.
Hank.
Reply to: