Batch file. Delete all files and folders in a directory

前端 未结 14 1355
无人共我
无人共我 2020-11-30 19:20

I want to have a batch file that will delete all the folders and files in my cache folder for my wireless toolkit.

Currently I have the following:

cd         


        
14条回答
  •  情书的邮戳
    2020-11-30 19:27

    You cannot delete everything with either rmdir or del alone:

    • rmdir /s /q does not accept wildcard params. So rmdir /s /q * will error.
    • del /s /f /q will delete all files, but empty subdirectories will remain.

    My preferred solution (as I have used in many other batch files) is:

    rmdir /s /q . 2>NUL
    

提交回复
热议问题