You can use -o
to specify an output directory, but this will add a layer of depth:
7z x -oMyDir some_file.zip
For example, if some_file
would normally output to some_file/
it will now output to MyDir/some_file/
.
If you just want to know the name of the top-level directory in the archive, that's a bit more tricky. You can get a list of files before extraction using the l
command:
7z l some_file.zip
but then you have to analyze the file names to see if there's a top-level directory at all. There doesn't have to be.