1

On a Windows machine, I've got about 50 subdirectories in the same directory, each with around 5 files in it. I want to get all 250-or-so files into one directory.

In a UNIX system, I'd just open a shell, type

mv */* ./

and be done with it.

I don't know how to do this in Windows. move */* ./ doesn't work.

onigame
  • 113

2 Answers2

2

This command is to be entered in the Command Prompt when the directory in question is the current:

for /r %i in (*.*) do move "%i" .

Note that overwriting files with the same name will fail.
Note also that it will move files from any depth, so do not use this command if your folders have sub-folders.

harrymc
  • 498,455
0

This command can be used in batch file or CMD:

forfiles /P . /S /M * /C "cmd /c if @isdir==FALSE move @path %cd%"

References: Example of forfiles

Note that overwriting files with the same name will overwrite it.