Best would be using a .bat file. But could also be Powershell if it's easier.

Now I'm using this:

for /r "M:\movies\new\" %%x in (*.mp4) do move "%%x" "M:\movies\new\"

but this works only for one extension (.mp4). How could I do this for multiple extensions?

  • 1
    Possible duplicate of Batch move a folder's content up one level – LotPings May 1 '18 at 21:40
  • You can put it like this (*.*) , right? – D T May 1 '18 at 21:54
  • But there are also some .txt files in it which I don't want. :S – JedatKinports May 1 '18 at 22:24
  • 1
    Use *.* and qualify the move statement: ... in (*.*) do if not %%~xx == .txt move .... – AFH May 1 '18 at 23:17

Windows (and MacOS plus *ix) predate the numerous extensions created to hold video. The OS just doesn't know how to tell what is a video file and what isn't, so you will need to run that command line for each extension you wish to move.

Alternatively, move the *.txt files to another directory, move everything remaining, then move *.txt back, a la

for /r "M:\movies\new\" %%x in (*.txt) do move "%%x" "M:\placeholder\"
for /r "M:\movies\new\" %%x in (*.*) do move "%%x" "M:\movies\new\"
for /r "M:\placeholder\" %%x in (*.txt) do move "%%x" "M:\original directory\"

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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