I have a zipped archive version 0.0.1: myarch_0.0.1.tar.gz
When I extract it with tar, everything is unzipped and extracted in a myarch
folder, stripping the version number.
ls
myarch_0.0.1.tar.gz
tar -zxvf myarch_0.0.1.tar.gz
ls
myarch/ myarch_0.0.1.tar.gz*
I want the extracted folder to be named: myarch_0.0.1/
How do I keep my version number stuck to the extracted folder name?
The name of an archive file, and the name of the files inside, have nothing to do with each other in general. If you want extracted directories to have a certain name, with a version number, then you have to create the archive with so named directories.
In this example, the extracted content is a directory named myarch
, instead of your desired myarch_0.0.1
. You can rename the directory and recreate the archive:
mv myarch myarch_0.0.1
tar zcf myarch_0.0.1.tar.gz myarch_0.0.1
That's it. When you untar this new archive, you will get a directory named myarch_0.0.1
, simply because that's what you put inside. Even if you rename this file to mickeymouse.tar.gz
, when you untar it, you will still get a directory named myarch_0.0.1
, simply because that's what's inside the archive. Nothing to do with the filename of the archive.