[Top][All Lists]

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

Re: Gnu Tar: Extracting files into a single directory

From: Pascal Bourguignon
Subject: Re: Gnu Tar: Extracting files into a single directory
Date: Mon, 19 Jun 2006 14:55:37 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Dubious Dude <> writes:
> I want to extract a number of files from a tar.gz archive.
> I want to extract them all into a single directory, regardless
> of their path in the archive.  I haven't found a switch in the
> gnu manual for this.  Is it possible?  I realize I can extract
> them into the directories as per their full path, then move
> them to a common directory.  But if gnu can extract them into
> the common directory, I use that feature of course.

But you can flatten the result with (untested):

tar -C output -zxf archive.tar.gz
cd output
find . -type f -exec mv -i {} . \;
find * -type d -prune -exec rm -rf {} \;

__Pascal Bourguignon__           

HEALTH WARNING: Care should be taken when lifting this product,
since its mass, and thus its weight, is dependent on its velocity
relative to the user.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]