I have a 7zip archive that has several files/folders that I want to extract to a specific place. I've simplified the example to make it minimal, complete, and verifiable.
-I don't want to maintain the directory structure, so I'm using the e
command. I just want all the files (in all the directories) to go to one place.
-I have a specific output directory, so I'm also using -o
.
A restriction is that I'm unable to alter the original archive (it would involve another team and I would prefer not to do that). I would ideally like to not have to hard code directories to remove after I extract the archive.
The problem comes after everything is extracted -- I'm left with some empty folders in my output directory. Is there a way for 7zip to either remove these empty directories or not create them in the first place?
My 7zip command line looks like:
D:\7z.exe e D:\MyArchive.zip -oD:\ExtractToHere
An example .zip file would have a structure like:
./A/1.txt
./B/2.txt
./C/3.txt
./D/fileWithNoExt
What I want in my output directory is (and nothing else):
./1.txt
./2.txt
./3.txt
./fileWithNoExt
What I have in my output directory is (A
, B
, and C
are all empty directories):
./1.txt
./2.txt
./3.txt
./fileWithNoExt
./A/
./B/
./C/
./D/