我正在尝试在Powershell(Windows 10和python django版本-2.2.7)中使用此命令删除除init。py以外的所有内容:
查找。 -path“ / blog / migrations /。py”-不是-name“ init。py” -delete
此项目的树(附加图像)
**如果我运行命令,我将收到此错误:
查找:参数格式不正确
该怎么办?先感谢您。我是python django的新手。**
以下脚本将删除所有未命名为“ init.py”的文件。确保在您要从中删除项目的文件夹的根目录下运行此程序。
Get-Childitem -File -Recurse | Where-Object{$_.Name -ne "init.py"} | Remove-Item -WhatIf
要测试,请保留-WhatIf
开关。如果显示要删除的文件,请在没有-WhatIf
开关的情况下再次运行。