How do you move all files inside subfolders into the parent folder. eg: move all mp3 files inside lots of folders into parent music folder?how to do from cmd? i want the simplest and easiest way to do this. i want a short simple cmd method


You can also use PowerShell:

Get-ChildItem *.mp3 -Recurse | Move-Item -Destination .

It searches all subdirectories of the current folder for .mp3 files and moves each to the current folder (.). You can change the filename/filter to make it work for other file types.

Compact version:

gci *.mp3 -R | mv -D .

To invoke from a normal command prompt:

powershell -Command "gci *.mp3 -R | mv -D ."

this will do it. BUT, the empty folders will not be deleted AND you need to edit the file type in the code for it to work. right now it will work only with mp3 files and. you also have to run this from the parent directory!! windows cmd only

forfiles /s /m *.mp3 /c "cmd /c move @path %CD%"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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