Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Batch file required for moving rars and zips.

27 May 2016   #1
val5662

Windows 7 ultimate 32bit
 
 
Batch file required for moving rars and zips.

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


My System SpecsSystem Spec
.
27 May 2016   #2
alphaniner

Windows 7 Professional x64, Arch Linux
 
 

Quote:
Findstr is capable of finding the exact text you are looking for in any ASCII file or files.
IOW findstr doesn't seem intended for searching for files stored in archives. Off the top of my head, I'd do something like this:

Code:
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
My System SpecsSystem Spec
27 May 2016   #3
val5662

Windows 7 ultimate 32bit
 
 
Re:Batch file required for moving rars and zips.

--SOLVED--
alphaniner....
Thanks a bunch!
Works 100%....I appreciate your help!
My System SpecsSystem Spec
.

27 May 2016   #4
alphaniner

Windows 7 Professional x64, Arch Linux
 
 

I'm happy it worked for you. That said, it's a fragile and minimally extensible solution. My command line chops come from Linux, so it's likely not particularly elegant or syntactically optimal. There is also no error handling whatsoever: I don't know enough about DOS to do any! If this is anything more than a "throwaway application" you should consider working towards something more robust.
My System SpecsSystem Spec
28 May 2016   #5
val5662

Windows 7 ultimate 32bit
 
 

alphaniner...
I understand what you mean,but for what I need it for it works super.
Thanks again!
My System SpecsSystem Spec
Reply

 Batch file required for moving rars and zips.




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
Batch file required
Hi guys... Windows 7 Ultimate 32 bit is my OS. Please help....thanks! I need a batch file that is run once from inside the same folder called Config as an "options.cfg" file,part of the text is listed below.I need to change the unknown number that follows the "draw_distance" to the number shown...
General Discussion
Please help me with Batch, need manual input required see description
Hi there, I am trying to create a batch file which will use the command nbtstat-a and then request the IP of the user within the same line (e.g. nbtstat-a *please enter the target IP to lookup*) to look up the machine name of a computer on the network, the only problem is that i dont know how to...
General Discussion
Batch file not waiting for command to finish before moving on
Hiya, i wasn't really sure where to put this, and i have Googled it but i can't find a reason why my batch file no longer does what it used to do. According to everything i've read, my batch should stop at IE, until i close IE, whereupon it should continue. This is how it used to behave. Here it...
Software
Need advice on batch file for moving files using Send To
Okay, here's what I want to do. I want to be able to have an entry in my "Send To" submenu to move (not copy) whatever files I have selected to "C:\Hold" With my very limited knowledge of batch files, I made a simple .cmd file that I put in the Send To folder with the following line: move %1...
General Discussion
Batch File that grabs file names from folder to insert into batch file
Ok I'm totally at a loss on how to word this so I'm just going to write it out the best that I can... :confused: First I have a batch file that I'm writing that will convert mp4 files to mp3 files (I have a lot) for a buddies band using ffmpeg. Here's the code that I'm using: ffmpeg -i...
General Discussion
Batch file for moving files to folder?
Hello, Wanted to see if any one here wouldn't mind writing a batch file or script that would move multiple files to a target folder. Here are the specifics: HDD1 Contains Folders A,B,C,etc... Folder A contains Folder A1 which contains File A2 Folder B contains Folder B1 which contains File B2...
General Discussion


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 11:17.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App