是否有使用find的正确形式?

问题描述 投票:0回答:1

我正在尝试在Powershell(Windows 10和python django版本-2.2.7)中使用此命令删除除init。py以外的所有内容:

查找。 -path“ / blog / migrations /。py”-不是-name“ init。py” -delete

此项目的树(附加图像)

enter image description here

**如果我运行命令,我将收到此错误:

查找:参数格式不正确

该怎么办?先感谢您。我是python django的新手。**

powershell command
1个回答
0
投票

以下脚本将删除所有未命名为“ init.py”的文件。确保在您要从中删除项目的文件夹的根目录下运行此程序。

Get-Childitem -File -Recurse | Where-Object{$_.Name -ne "init.py"} | Remove-Item -WhatIf

要测试,请保留-WhatIf开关。如果显示要删除的文件,请在没有-WhatIf开关的情况下再次运行。

© www.soinside.com 2019 - 2024. All rights reserved.