ste*_*tej 43
如果你真的想删除.svn目录,这可能会有所帮助:
gci c:\yourdirectory -include .svn -Recurse -Force |
Remove-Item -Recurse -Force
Run Code Online (Sandbox Code Playgroud)
编辑:添加了-Force
参数以gci
列出隐藏目录并缩短了代码.
Keith是正确的,你需要避免删除扩展名为.svn的文件,你应该使用过滤项目?
.
Kei*_*ill 10
假设您不想删除任何可能具有.svn扩展名的文件:
Get-ChildItem $path -r -include .svn -Force | Where {$_.PSIsContainer} |
Remove-Item -r -force
Run Code Online (Sandbox Code Playgroud)
微软在下面的评论中回应了Keith在MS Connect上开启的建议!由于PowerShell的V3,你可以用额外的(很慢)管办客场Where {$_.PSIsContainer}
和使用-directory
,而不是:
gci $path -r -include .svn -force -directory | Remove-Item -r -force
Run Code Online (Sandbox Code Playgroud)
可以在Windows Management Framework 3.0上为Windows 7下载PowerShell v3 .
归档时间: |
|
查看次数: |
9032 次 |
最近记录: |