I have a 7z file that contains folders and can also have .zip archives inside it. Given a filepath inside the zip archive, I would like to extract only this file without its path. So far, all I managed to do is to extract a file that's inside a folder using the following command:
7z e <file.7z> */<some_folder>/my_file.txt -r -aou -y
However, when I replaced <some_folder>
with the name of a zip file, it didn't work.
Is there a way to achieve what I want? I'm looking for a solution using either the command-line (cmd) or Python.
I'm aware of the extract()
function in py7zr, but it extracts the file with its directory structure, which is not what I need.
all I managed to do is to extract a file that's inside a folder using the following command:
7z e <file.7z> */<some_folder>/my_file.txt -r -aou -y
However, when I replaced <some_folder>
with the name of a zip file, it didn't work.