ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > General Software Discussion

[DISCUSSION] How to extract embedded zip/rar files recursively in one step?

<< < (3/3)

vixay:
vixay:
from the structure you presented, it seems that you need a tool like Rarslave or other similar Usenet binary tools.
-lanux128 (September 18, 2006, 03:08 AM)
--- End quote ---

Hmm... didn't work out with the test archive... i guess it ignores it because its a zip.... even after disabling the RAR only flag it doesnt' work...

wr975:

I wrote a AHK script for myself once + integrated it in 2xplorer. So I just click a button and all archives in the folder get unpacked. Perhaps it's of use for you? It unpacks all archives in a folder in a subfolder (archive-name).

Installation: paste code in notepad, edit the second line pointing to winrar.exe, save as whatever.ahk, install authotkey (autohotkey.com)

Usage: Copy sourcefolder in clipboard and launch the script, or pass the sourcefolder as first parameter. An optional second parameter would be a targetfolder (where to place unpacked files).

Limitation: Some (rare) RAR names makes it to mess up. Didn't figure that out yet.


AHK Code:
Spoiler#SingleInstance force
winrar = C:\progs\system\winrar\winrar.exe

eins = %1%
zwei = %2%

If 1 =
   Target = %Clipboard%
else
   Target = %1%

IfNotExist,%Target%
   {
   MsgBox,No parameters given:`n`n#1 = Sourcefolder`n#2 = Targetfolder (optional, else it'll unpack in SourceFolder)
   ExitApp
   }


Loop,%target%\*.*
   {
   SplitPath,A_LoopFileFullPath,UnpackFileName,UnpackPath,UnpackExtension,Unpackname

   If UnpackExtension = zip
      {
      StringLen,UnpackLaenge,UnpackName
      UnpackLaengeMinus := UnpackLaenge - 2
      StringMid,UnpackDatei,UnpackName,1,%UnpackLaengeMinus%
      Unpack(A_LoopFileLongPath,UnpackPath,UnpackDatei,eins,zwei)
      Continue
      }

   If UnpackExtension = 001
      {
      Unpack(A_LoopFileLongPath,UnpackPath,UnpackName,eins,zwei)
      Continue
      }

   If UnpackExtension = rar
      {
      If Unpackname contains .part
         {
         StringLen,UnpackLaenge,UnpackName
         if UnpackFileName contains .part1.
            {
            UnpackLaengeMinus := UnpackLaenge - 5
            StringMid,UnpackDatei,UnpackName,1,%UnpackLaengeMinus%
            Unpack(A_LoopFileLongPath,UnpackPath,UnpackDatei,eins,zwei)
            }

         if UnpackFileName contains .part01.
            {
            UnpackLaengeMinus := UnpackLaenge - 6
            StringMid,UnpackDatei,UnpackName,1,%UnpackLaengeMinus%
            Unpack(A_LoopFileLongPath,UnpackPath,UnpackDatei,eins,zwei)
            }

         if UnpackFileName contains .part001.
            {
            UnpackLaengeMinus := UnpackLaenge - 7
            StringMid,UnpackDatei,UnpackName,1,%UnpackLaengeMinus%
            Unpack(A_LoopFileLongPath,UnpackPath,UnpackDatei,eins,zwei)
            }

         if UnpackFileName contains .part0001.
            {
            StringLen,UnpackLaenge,UnpackName
            UnpackLaengeMinus := UnpackLaenge - 8
            StringMid,UnpackDatei,UnpackName,1,%UnpackLaengeMinus%
            Unpack(A_LoopFileLongPath,UnpackPath,UnpackDatei,eins,zwei)
            }
         Continue
         }         
      Unpack(A_LoopFileLongPath,UnpackPath,Unpackname,eins,zwei)
      Continue
      }
   }

ExitApp


Unpack(source,target,name,eins,zwei)
{
if zwei =
      RunWait,%winrar% x -o+ "%source%" "%target%\%name%\"
else
      RunWait,%winrar% x -o+ "%source%" "%zwei%\%name%\"
}

Navigation

[0] Message Index

[*] Previous page

Go to full version