Main Area and Open Discussion > General Software Discussion
[DISCUSSION] How to extract embedded zip/rar files recursively in one step?
vixay:
This has been bugging me for a while...
Often when you dowload something it is compressed multiple times and is very annoying to extract.
e.g.
--- ---xx.zip
-yy1.zip
--yy1.rar
---zz.exe
-yy2.zip
--yy2.rar
---zz.exe
-yy3.zip
--yy3.rar
---zz.exe
So for the above case which shows the directory structure of xx.zip file. Now how can i extract zz.exe in one step, without having to first extract xx.zip, then all yy#.zip, then yy#.rar?
I have beel looking everywhere! Unrar can extract embedded files, but not split embedded files... don't ask me to explain, try it yourself.
anybody have any ideas/suggestions?
Actually i figured out one script that works for me
--- ---@echo OFF
SET "dir=."
SET "ext=*.zip"
winRAR x -o+ %1
FOR /r "%dir%" %%* IN (%ext%) DO (
winRAR x -o+ "%%*" "%%~dp*"
del "%%*"
)
winrar x -r -o+ *.part1.rar
del /s *.part?.rar
but this works only for a specific case (i.e. where you have an archive in which you have zip files in which you have rar files)
can it be improved to work for all cases?
AbteriX:
Allways the same structure?
Maybe with an batch.cmd:
C:\>UNPACK *.zip INTO STEP1
CD STEP1
C:\STEP1>UNPACK *.zip INTO STEP2
CD STEP2
C:\STEP1\STEP2>UNRAR *.rar INTO STEP3
CD STEP3
C:\STEP1\STEP2\STEP3>EXTRAXT *.exe INTO STEP4
... to be continue
vixay:
Actually, no. That's the whole point! I want something that works with all cases (not a specific case)
The script i provided works for a specific case of zip/rar(zip(rar)))
And i want to preserve the directory structure, and remove the intermediate files.
So let me restate my objective: Extract all archives from within an archive (passed parameter) and/or directory (i.e. recursive), while preserving directory structure and deleting intermediate files generated.
Save the following code in a batch file with the name extract3levels.cmd
--- ---@echo OFF
REM //Set up some variables
SET "dir=."
SET "ext=*.zip"
REM //Extract the passed file, to current directory
REM //overwriting files.
winRAR x -o+ %1
REM //Should have a graceful error case here to make sure the operation completed
REM //successfully, if not then exit script... how to do this?
REM //Now in the current directory extract each zip file into its folder
REM //Delete the file after extracting it
FOR /r "%dir%" %%* IN (%ext%) DO (
winRAR x -o+ "%%*" "%%~dp*"
del "%%*"
)
REM //Now search for a file ending with part1.rar in all subdirectories and extract it
winrar x -r -o+ *.part1.rar
REM //Delete all files ending with a part?.rar in all subdirectories
del /s *.part?.rar
REM Usage:
REM program_name <archive>
the above script works, but maybe what i want needs a more flexible language, maybe autohotkey can do this...?
Cloq:
Hmm.. Total Commander handles that for me. Since it "opens" archives as directories/folders, all you have to do is keep pressing enter/clicking on it till you get to the actual file. Then you can drag/copy it out to the desktop (or wherever) or to the other windowpane. So far I have tested with multi-level combinations of zips and rars nest in each other, 6 archive deep.
vixay:
Hmm.. Total Commander handles that for me. Since it "opens" archives as directories/folders, all you have to do is keep pressing enter/clicking on it till you get to the actual file. Then you can drag/copy it out to the desktop (or wherever) or to the other windowpane. So far I have tested with multi-level combinations of zips and rars nest in each other, 6 archive deep.
-Cloq (September 14, 2006, 01:16 PM)
--- End quote ---
That's ok. Even winrar can do that. with only 1 archive embeded (no matter how many levels) it is ok to do this, but what about when you have 5 archives in 1 archive, and then in those 5 archives you have 1 archive each, but that 1 archive is a split archive... so to extract the files, you need to get all those 5 archives hidden within each of those split archives and then extract them.. sigh, i guess i am not making much sense, let me see if i can whip up a sample for you...
Navigation
[0] Message Index
[#] Next page
Go to full version