1.

Solve : Auto unrar?

Answer»

Hi guys.
I found this script on another forum and it works like a charm.

Code: [Select]@REM ------- BEGIN demo.cmd ----------------
@setlocal
@echo off
set PATH="C:\Program Files\WinRAR\";%path%
for /F %%i in ('dir /s/b *.rar') do call :do_extract "%%i"
GOTO :eof

:do_extract
echo %1
mkdir %~1.extracted
pushd %~1.extracted
unrar e %1
popd

REM ------- END demo.cmd ------------------
There's only one problem. Somethimes the .rar FILE is named
file_name.part1.rar
file_name.part2.rar
file_name.part3.rar
and so on
. So if it is 24 parts it means that the file/movie or what ever will be unpacked 24 times
I've tried to search the web for an answer but cant find anything.One way would be to process the rar file or files in 2 stages:

1. The rar files which do not have ".part" in the name.

2. The rar files whose name ENDS with ".part1.rar".

By the way, I fixed a few THINGS in that script... it handles files with spaces in the names now.

Code: [Select]@setlocal
@echo off
set path="C:\Program Files\WinRAR\";%path%
for /F "delims=" %%i in ('dir /s/b *.rar ^| find /v ".part"') do call :do_extract "%%i"
for /F "delims=" %%i in ('dir /s/b *.part1.rar') do call :do_extract "%%i"
goto end

:do_extract
echo %1
mkdir "%~1.extracted"
pushd "%~1.extracted"
echo unrar "%1"
unrar e "%~dpnx1"
popd
goto :eof

:end

sorry, accidentally clicked "quote"
Sweet. I'll test it asap.
Thanks for the help



Discussion

No Comment Found