How to repack many directories with files inside

As i promised, here i write my first tutorial on how to repack many directories.

Things that you will need:

Windows
1xFile manager or shell (Total Commander, Double Commander, Master Commander, muCommander, wxCommander, etc)
7zip or FreeARC or NanoZip (its still experimental, but beats even FreeARC)
2xhands
and finally most hard one to find in this age of unlimited human stupidity: exactly 1xbrain (which likes to function at maximum 10% btw)

Note: If you have very big harddisk capacity, don't waste your time reading this.

How many of you weren't confronted with the following problem:

You had so repack from many files which were in subdirectories to another format
(in this case .7z, but i guess you cound adapt to even better one FreeARC
which rocks, take this advice from a packing maniac like me Tongue),
if you do this manually it will take a looooott of work and sweat,
especially if you wanna pack all Doom 1 and Doom 2 levels for example (like i did btw) or Quake 3 levels...

For this example i used Doom 1 and/or 2 levels, which were grouped after first letter, like 0-9, a-c, d-f, etc

Lets go to work:

1. ATTENTION! Make sure root directory does not contain space, ex "work folder", rename it instead "workfolder" or "work_folder".
So no space in folder names (and probably in file names) or this will fail, eh ? Good...

2. UNPACKING:

Create a batch file, name it anyway you like, for example unpack.bat:

-------------

for /F %%I IN ('dir /b /s *.zip *.rar *.lhz *.arj') DO (
    "C:\Program Files\7-Zip\7z.exe" x -o"%%~dpI" "%%I"
)
for /F %%I IN ('dir /b /s *.zip *.rar *.lhz *.arj') DO (
    del "%%I"
)

-------------
note: put without '-'

copy it into path or into c:\windows
go into the directory "C:\WORK_FOLDER\" where you need to unpack all files and run unpack.bat
if the packed files are not having directory and you want also to create them
replace %%~dpI with *

3. REPACKING:

Create again a batch file, name it repack.bat, paste this inside:
------------

for /d %%X in (*) do "c:\Program Files\7-Zip\7z.exe" a "%%X.7z" ".\%%X\*" -mmt=on -m0=LZMA:d=26:mf=bt4:lc=3:fb=64:lp=0:pb=2:mc=48
for /d %%X in (*) do rd /s /q "%%X"

------------
NOTE: for this to work you need to enter into subfolder, ex NOT "C:\WORK_FOLDER", but "C:\WORK_FOLDER\0-9",
"C:\WORK_FOLDER\a-c\" and so on. Hope isn't hard for you to type "repack" because it will repack TONS of folders if any.

4. I could add bells and whistles (read pictures), but hey... KISS way (Keep It Simple Stupid) is always better, no ? Happy

5. Before criticize this (so many users gatter 10000k posts criticize others, go and check if not believe me!), think that if this isn't useful to you, surely its to others which were confronted with this problem.

6. Feel free to adapt it to your own needs and purposes.

P.S. If you want to use FreeARC, i kindly suggest the following command to pack:
arc a -mx -ld1600mb -md1600mb -r -dsgeipn archivename *.*
or
arc a -mx -ld800mb -dsgeipn archivename *.*

P.P.S. Hope this will be useful to someone. For me this were heavenly mana if someone else would mixed this together in one piece before
entering on 100 sites, figuratively speaking, for bits and bobs.

D3L1GH7
TanaKa's picture
Offline
Joined: May 2010
Posts:
Re: How to repack many directories with files inside

Have you ever heard about PAQ8PX ? For me, this is the best compression software.

"Skill is when luck becomes a habit".

Dexter
DexterLab23's picture
Offline
Joined: Oct 2011
Posts:
Re: How to repack many directories with files inside

Yes of course PAQ its the best compression out there, but also its the slowest one, at least at the moment...

"Be careful what you choose!"

ROSOMAK
Adrian87's picture
Offline
Joined: Apr 2010
Posts:
Re: How to repack many directories with files inside

this topic was be good mb 5 years ago or 10 Happy Now everybody have big hdd.

prorok
Offline
Joined: Jul 2012
Posts:
Re: How to repack many directories with files inside

Tongue