我需要一种递归删除文件夹及其子级的方法。
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 不会删除目录。
DELTREE 已从Windows 2000+中删除
DELTREE was removed from Windows 2000+
推荐答案RMDIR或RD(如果您是使用经典的命令提示符(cmd.exe):
RMDIR or RD if you are using the classic Command Prompt (cmd.exe):
rd /s /q "path"
RMDIR [/ S] [/ Q] [驱动器:]路径
RMDIR [/S] [/Q] [drive:]path
RD [/ S] [/ Q] [drive:] path
RD [/S] [/Q] [drive:]path
/ S还将删除指定目录中的所有目录和文件到目录本身。 用于删除目录树。
/S Removes all directories and files in the specified directory in addition to the directory itself. Used to remove a directory tree.
/ Q安静模式,不要问是否可以使用/ S删除目录树
/Q Quiet mode, do not ask if ok to remove a directory tree with /S
如果使用PowerShell,则可以使用 Remove-Item (别名为 del ,删除, rd , ri , rm 和 rmdir )并进行-递归可以缩写为 -r
If you are using PowerShell you can use Remove-Item (which is aliased to del, erase, rd, ri, rm and rmdir) and takes a -Recurse argument that can be shorted to -r
rd -r "path"更多推荐
“ rm
发布评论