tags:

views:

125

answers:

1

I have an tarball, myarchive.tar.gz. When I uncompress it using "tar -zxvf myarchive.tar.gz", it creates a folder myarchive-x980-2303-ssioo. What's the easiest way to automatically rename the extracted folder to ensure it matches the name of the archive? I've checked tar's manpage, but it doesn't seem to have an option for this.

+2  A: 

Manually create folder, and strip components from tarball:

archive=my.tar.gz
mkdir ${archive%.tar*} 
tar --extract --file=${archive} --strip-components=1 --directory=${archive%.tar*}
Jürgen Hötzel
Beautiful. Thanks.
Chris S