9
Is there a way to extract a 7z archive that contains all it's files within a directory without creating this directory in the file system but still keeping the sub-directory structure of the archive (so 7z e ...
is not working as desired, because it strips all path info)?
In tar I would use tar -x --strip=1 ...
to strip the first path component. Is there some equivalent for 7z or do I have to extract with the unwanted path segment, move the contents to the right place and delete the directory?
Although you can't do this while extracting, you can strip the archive root folder when compressing. Instead of
7z a archive.7z path\to\folder
do7z a archive.7z path\to\folder\*
to stripfolder
from the archived path name. – jpaugh – 2018-08-01T17:21:56.0831Looking at 7z command line options, I don't it's possible in one shot. Probably use
7z x
to create the structure,7z e
to strip path info and then delete the files created by7z x
, tried it, it's still not what you want. – Sathyajith Bhat – 2012-05-07T04:17:03.430