0

I have a directory with a lot of text files and other bits of data that are stored in RAR files, however each RAR file (for some ridiculous reasons I cannot fathom) is stored in a directory with the same name. Thus, I have the following to work with:

Parent Directory
 >AAAAA
  >AAAAA.rar
 >BBBBB
  >BBBBB.rar
 >CCCCC
  >CCCCC.rar

Normally I could manually go in and extract each myself, but there's hundreds of these little subfolders, each with a single file in them.

What would be the most efficient way to use .bat to pull each .RAR file upwards a directory so they can be more easily selected and unpacked all at once and save me a couple hours of painful extracting?

Tyro
  • 1
  • 1
  • The suggestion below is quick and easy, for a batch http://stackoverflow.com/questions/1502170/how-to-copy-files-from-folder-tree-dropping-all-the-folders-with-robocopy – Alex K. Feb 13 '13 at 16:44

2 Answers2

2

Might I recommend: Use the Windows search tool to search for *.rar. Select all the results and drag them to the desired folder.

Dark Falcon
  • 43,592
  • 5
  • 83
  • 98
0

Following code will work for you, Just change the folder path as per your requirement

    @Echo OFF
    SET PATH1= E:\BackUp\
    FOR /F %%G IN ('DIR /b %PATH1%') DO CALL :Folders "%%G" 

    EXIT /b

    :Folders
    SET str1=%~1
    Echo %str1%
    copy %PATH1%%str1% E:\BackUp
Shirulkar
  • 484
  • 2
  • 4