The evil Windows -- Command line, copy and delete files

In case we have the following directory:

c:\XXXProject\Include\

And the directory sub neath may contains lots of files, sub directories, and so on.

We want to remove this 'Include' path and re-construct it post the XXX project has been built, and if we simply use the command:

RD Include /Q /S

to delete the directory, because delete files action and delete directory action are go paralleled, sometime may cause the system fail. For safety, we should always take this action into two steps: first remove the files, and then remove the directories, such as:

::no matter the directory want to be removed is read only or not, force clean all the files

DEL Include/*.* /S /F /Q

:: and then remove the directories

RD Include /S /Q

this will guarantee the action won't fail, and we can recreate the 'Include' directory without system warnings:

MD Include


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章