Batch file required for moving rars and zips.

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
val5662
Posts: 34
Joined: 18 Dec 2013 09:48

Batch file required for moving rars and zips.

#1 Post by val5662 » 27 May 2016 15:21

Batch File required to move rar and zip files to a folder according to the word car anywhere inside the archive.
Here is what I have.It works in a test folder with 2 rars and 1 zip but when I put it in the folder with four hundred rars and zips,it creates the folder and just hangs at the "please wait" message for two hours.
Please help....thanks!

@echo off
md cars
echo CARS BEING MOVED TO THE cars FOLDER
echo PLEASE WAIT
for /f "eol=: delims=" %%F in ('findstr /m /i .car *.rar,*.zip') do @move "%%F" cars >nul
echo.
echo.
echo.
echo.
cls
color a0
echo ALL CAR FILES MOVED TO THE cars FOLDER SUCCESSFULLY
echo.
echo.
echo.
echo.
pause
exit /b

val5662
Posts: 34
Joined: 18 Dec 2013 09:48

Re: Batch file required for moving rars and zips.

#2 Post by val5662 » 27 May 2016 17:35

SOLVED:
alphaniner in another forum solved it:
for %%F in (*rar,*.zip) do "C:\Program Files\7-Zip\7z.exe" l "%%F" | findstr /m /i /e ".car" >NUL && move "%%F" cars >NUL
The code above worked 100%
Thanks anyway guys!

Post Reply