得分
57
Advertisement
答案 (13)
解决方案找到了!
得分
81
2014-04-15 13:18:38 +0000
这可以用PowerShell:
Get-ChildItem -Path C:\Temp -Include *.* -File -Recurse | foreach { $_.Delete()}
这个命令可以得到$path中的每一个子项,并对每一个子项执行删除方法,速度相当快。
MDMoore313
http://superuser.stackexchange.com/users/257589
Advertisement
得分
29
2017-11-02 17:21:27 +0000
短小精悍,套用PowerShell。不知道它能用什么最低的PS版本。
Remove-Item c:\Tmp\* -Recurse -Force
Evan Nadeau
http://superuser.stackexchange.com/users/257589
Advertisement
Advertisement
得分
4
2014-10-28 15:39:38 +0000
使用PowerShell:
Get-ChildItem -Path c:\temp -Include * | remove-Item -recurse
Gregory Suvalian
http://superuser.stackexchange.com/users/257589
得分
3
2018-05-10 07:13:40 +0000
使用PowerShell删除单个文件或文件夹。在执行PowerShell中的Delete命令之前,我们需要确认你已经登录到服务器或电脑上,并且有一个可以完全访问你要删除的对象。 txt" 上面的命令将执行并删除 “DummyfiletoDelete.txt "文件,该文件存在于 "C:\dotnet-helpers "位置。 # 使用PowerShell commnads删除所有文件和文件夹 > Remove-Item -Path "C:dotnet-helpers.” -recurse
钻研下去,找到更多的文件。-recurse参数将允许PowerShell在不要求权限的情况下删除任何子项。此外,还可以添加-force参数来删除隐藏的或只读的文件。
thiyagu selvaraj
http://superuser.stackexchange.com/users/257589
Advertisement
Advertisement
得分
1
2016-10-12 20:45:27 +0000
这是最简单的方法
打开PowerShell,导航到目录(cd),THEN
ls -Recurse * | rm
(Poof)一切都没有了…..
如果要删除基于特定的扩展名
ls -Recurse *.docx | rm
ls是列出目录
-Recurse是一个标志,告诉powershell要进入任何子目录
*说的是一切
*.doc的一切都是带.doc扩展名的。 doc 扩展
|从左边的输出到右边的输出
rm删除
所有其他的答案似乎都让人更加困惑。
Kolob Canyon
http://superuser.stackexchange.com/users/257589
得分
0
2020-02-04 17:43:55 +0000
使用Powershell 5.1:
$extensions_list = Get-ChildItem -Path 'C:\folder_path
* * * * * * * *
它删除了所有不是目录的Itens. -Recurse
foreach ( $extension in $extensions_list) {
if ($extension.Attributes -notlike "Directory") {
Remove-Item $extension.FullName
}
}
它删除了所有不是目录的Itens.
Maycon Paixão
http://superuser.stackexchange.com/users/257589
得分
0
2020-03-01 06:34:32 +0000
我们可以通过下面的命令删除文件夹中的所有文件及其子文件夹。
Dishant Batra
http://superuser.stackexchange.com/users/257589