Islam Adel
Architect & IT Expert

Select your language

Here I will add useful commands to use in the windows command line:



Recursive move

As many have noticed, with the standard MOVE command from the command line it is not possible to move the contents of a folder with all its subfolders to any destination.
As an example: I would like to move the contents of the folder C:\folder1\folder2 one level higher to C:\folder1
If you use: 

MOVE "C:\folder1\folder2\*" "C:\folder1\"

Only files inside folder2 will be moved and folders/subfolders will be ignored.
Using the following command our aim can be fulfilled:

FOR /R "C:\folder1\folder2\" %i in (.,*) DO MOVE /Y "%i" "C:\folder1\"

The . [dot] moves the folders and the * [star] moves the files (Please always keep in this order), /Y to overwrite existing files without prompting.
Remember to replace %i by %%i to run it within a batch file.