“rm -rf” equivalent for Windows?

前端 未结 21 1525
一向
一向 2020-11-27 08:40

I need a way to recursively delete a folder and its children.

Is there a prebuilt tool for this, or do I need to write one?

DEL /S doesn\'t dele

21条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-27 09:27

    Using Powershell 5.1

     get-childitem *logs* -path .\ -directory -recurse | remove-item -confirm:$false -recurse -force
    

    Replace logs with the directory name you want to delete.

    get-childitem searches for the children directory with the name recursively from current path (.).

    remove-item deletes the result.

提交回复
热议问题