Batch file required for moving rars and zips.


  1. Posts : 10
    Windows 7 ultimate 32bit
       #1

    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 Computer


  2. Posts : 201
    Windows 7 Professional x64, Arch Linux
       #2

    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 Computer


  3. Posts : 10
    Windows 7 ultimate 32bit
    Thread Starter
       #3

    Re:Batch file required for moving rars and zips.


    --SOLVED--
    alphaniner....
    Thanks a bunch!
    Works 100%....I appreciate your help!:)
      My Computer


  4. Posts : 201
    Windows 7 Professional x64, Arch Linux
       #4

    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 Computer


  5. Posts : 10
    Windows 7 ultimate 32bit
    Thread Starter
       #5

    alphaniner...
    I understand what you mean,but for what I need it for it works super.
    Thanks again!
      My Computer


 

  Related Discussions
Our Sites
Site Links
About 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 20:14.
Find Us