Please do not mistake this question with "how to untar a tar file into an existing directory". For this question there are already answers such as this one
What I am trying to do is to untar an tar.gz file but put the contents into a directory
The linked answer for example when you do it creates a folder (with the name of the tar file) and puts the contents inside the folder
What I want is to not create the folder but put the contents inside an already existing directory.
How can this be done?
tar -xf archive.tar -C /path/to/dir
is doing. There won't be any directories created with the name of the tar file. – pLumo Jul 12 '23 at 07:42--strip-components 1
to do what I intend. Sorry for the confusion – KansaiRobot Jul 12 '23 at 07:44--strip-components
will remove the first direrectory INSIDE thetar
file. So it is content of yourtar
file!tar -x
won't create any other directories. Note:--strip-components
means, that if you have the same file name in different directories, they might get overwritten. – pLumo Jul 12 '23 at 08:03