rutgermons
asked on
extract a specific file from zip directory
Folks
I have a batch that unpacks all files from a zipped file
@echo off
set SRC=C:\Daily\Received
set DEST=\\bp1xgbap670\Daily\U npacked
for /f "tokens=1,2,3 delims=/" %%a in ('echo %DATE%') do set TODAY=%%a%%b%%c
REN "%SRC%\maximo.ear" "maximo.zip"
if not exist "%SRC%\maximo.zip" goto :NOFILE
REM -o is Destination folder
REM -p is Password to automatically enter - change this to suit
REM -y is option to accept all prompts
C:\Progra~1\7-Zip\7z.exe e -o"%DEST%\maximo" -y "%SRC%\maximo.zip"
7z e -o"%DEST%\maximo" -y "%SRC%\maximo.zip"
goto :END
:NOFILE
echo.
echo Sorry, the file:
echo %SRC%\maximo.zip
echo Was not found.
echo.
echo Press any key to quit ...
pause > nul
:END
but how to i only extract a file called "tester.jar" from maximo.zip?
all help will do
I have a batch that unpacks all files from a zipped file
@echo off
set SRC=C:\Daily\Received
set DEST=\\bp1xgbap670\Daily\U
for /f "tokens=1,2,3 delims=/" %%a in ('echo %DATE%') do set TODAY=%%a%%b%%c
REN "%SRC%\maximo.ear" "maximo.zip"
if not exist "%SRC%\maximo.zip" goto :NOFILE
REM -o is Destination folder
REM -p is Password to automatically enter - change this to suit
REM -y is option to accept all prompts
C:\Progra~1\7-Zip\7z.exe e -o"%DEST%\maximo" -y "%SRC%\maximo.zip"
7z e -o"%DEST%\maximo" -y "%SRC%\maximo.zip"
goto :END
:NOFILE
echo.
echo Sorry, the file:
echo %SRC%\maximo.zip
echo Was not found.
echo.
echo Press any key to quit ...
pause > nul
:END
but how to i only extract a file called "tester.jar" from maximo.zip?
all help will do
this is easy with the command line pkunzip.exe utility
pkunzip "%SRC%\maximo.zip" -e <filename>
This would extract the specific filename from the zip.
pkunzip "%SRC%\maximo.zip" -e <filename>
This would extract the specific filename from the zip.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
bill, changed it a bit to work,thanks for the pointer
C:\Progra~1\7-Zip\7z.exe e -o"%DEST%\maximo" "%SRC%\maximo.zip" businessobjects.jar -y
C:\Progra~1\7-Zip\7z.exe e -o"%DEST%\maximo" "%SRC%\maximo.zip" businessobjects.jar -y
Great, glad you got it sorted out, thanks.
~bp
~bp
The (ostensible) excuse is that "7z's default behavior is to create "solid" archives for better compression. It is impossible to extract single files from such archives."
Personally, I use plain old, free unzip.exe which will do what you want.
Available many places, for example:
http://stahlworks.com/dev/index.php?tool=zipunzip