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

后端 未结 7 2596
故里飘歌
故里飘歌 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:35

    That won't work - you'll get an error telling you the target directory is inside the source directory or so, even if you explicitly exclude the target directory. What you can do is move the directories to a temporary location which is not under the source, and then move them into the target.

    BTW, using the move command won't let you specify folders to exclude. For that you can use xcopy, but note that it will copy the folders, as opposed to move them. If that matters, you can delete whatever you want afterwards, just make sure you don't delete the target dir, which is in the source dir...

提交回复
热议问题