I am trying to write a Windows Batch file that will allow me to move all directories within a given source directory into a target directory that exists within that source directory.
Obviously my move command with need to only apply to directories and also exclude the target directory from being processed.
Is this possible with a Windows batch command?
On windows batch:
FOR /d %%i IN (MySourceDirectory\*) DO move "%%i" MyTargetDirectory\%%~ni
The above command moves all directories found in MySourceDirectory (/d) to MyTargetDirectory using the original directory name (~ni) Robocopy's move first does a copy, then delete, so it is slower.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With