Windows batch command to move all folders in a directory with exceptions

后端 未结 7 2514
故里飘歌
故里飘歌 2021-02-19 18:03

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 direc

7条回答
  •  旧巷少年郎
    2021-02-19 18:45

    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.

提交回复
热议问题