Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a script which uses 7zip to extract all rar files which is great.

The only problem is then I have to manually go through the folders and move the .avi or .mkv files.

The script I am currently using

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

My current setup:

D:\rared\loads of folders names, then I move them all to D:\rared\extracted

Is there a way to modify the first script or just write another one to move all the files in all sub directories to the extracted folder?

share|improve this question
add comment

2 Answers

Try changing the 7z command line you have, adding -oD:\rared\extracted

So "C:\Program Files\7-zip\7z.exe" x %%X
becomes "C:\Program Files\7-zip\7z.exe" x %%X -oD:\rared\extracted

share|improve this answer
    
note- looks like you can change 7z e for 7z x, or keep 7z x. whichever. Also I haven't tried your setup. so it's not entirely tested in an ideal sense, but give it a try. –  barlop Feb 2 '13 at 11:13
add comment

Sorry I am late. Below is what I would do. I set the min file size of 12,345KB to avoid all those annoying Sample clips (adj up as you wish). I have absolutely no way of testing it because I use rar.exe, the e/x shouldn't matter. Let me know if this works for you or if you want some other feature or if you have any ?s

SetLocal
Set BaseDir     =D:\Rars\
Set TempDir     =D:\rared\extracted\
Set GoodStuff   =D:\GoodStuffToWatch\
Set MinFileSize =12345

FOR /R %BaseDir% %%F in (*.RAR *.ZIP) DO "C:\Program Files\7-zip\7z.exe" x "%%~fF" -o%TempDir%
FOR /R %TempDir% %%G in (*.AVI *.MKV) DO IF %%~zG GTR %MinFileSize% Move "%%~fG" %GoodSTufF%
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.