Copy any file with a specific file extension in subfolders into a folder

Posted by Onyxius on Server Fault See other posts from Server Fault or by Onyxius
Published on 2013-10-14T05:33:49Z Indexed on 2013/10/17 21:59 UTC
Read the original article Hit count: 148

Filed under:
|
|
|
|

I found a script on here that would use 7zip and extract all the files in all the sub-folders of a specific folder and put them in their own folder using the script below.

What I need is add to it or maybe use another script if i have to and specify where i want those files to go instead of putting them in their own folder within the folder. I don't know how to do this and hope someone would be able to help.

Thanks for the help

 @echo on

FOR /D /r %%F in ("*") DO ( 
      pushd %CD% 
     cd %%F 
        FOR %%X in (*.rar *.zip *.tar) DO ( 
                "C:\Program Files\7-zip\7z.exe" x -o"%%~nX" "%%X"

)
     popd 
)

© Server Fault or respective owner

Related posts about Windows

Related posts about files