Solved Multiple 7z extraction (extract to directory with same name)

March 2, 2013 at 10:32:12
Specs: Windows XP
prgms\7za.exe e 7z_dir\0B909427.7z -o"%userprofile%"\desktop\7extract\0B909427 *.* -x!*.*_ -x!*.txt -r

NOTE: The command above is for a single 7-zip file for which i need to use for multiple files

I need help extracting all 7z files in the 7z_dir directory and each 7-zip archive extracts to a folder with the same name as the 7-zip file.


7extract\
     0B909427\ 
	< extracted files from 0B909427.7z >
     A4776B43\ 
	< extracted files from A4776B43.7z >
     0B258427\ 
	< extracted files from 0B258427.7z >
     76BA4743\ 
	< extracted files from 76BA4743.7z >

Thanks in advance to anyone who can help.


See More: Multiple 7z extraction (extract to directory with same name)

Report •

#1
March 2, 2013 at 12:03:43
✔ Best Answer
@echo off & setlocal
for %%a in (7z_dir\*.7z) do (
prgms\7za.exe e 7z_dir\%%a -o"%
userprofile%"\desktop\7extract\%%~na *.* -x!*.*_ -x!*.txt -r
)
::==== end
You can run it from 7z_dir or from one level up from 7z_dir, as written.

Report •

#2
March 3, 2013 at 04:53:12
Thanks for your help nbrane

Below is the code i used

@echo off 
SETLOCAL

SET OUTDIR="%USERPROFILE%\desktop\7extract"
SET SRCDIR="7z_Dir"

for %%a in (%SRCDIR%\*.7z) do (prgms\7za.exe e %SRCDIR%\%%~na.7z -o%OUTDIR%\%%~na *.* -x!*.*_ -x!*.txt -y -r)


Report •
Related Solutions


Ask Question