[英]PowerShell: How do you delete a folder with a name that starts with a dot (e.g. “.svn”)
Tried this: 试过这个:
Remove-Item "C:\foo\.svn"
but this is the error that I encountered 但这是我遇到的错误
Remove-Item : Cannot find path 'C:\foo\.svn' because it does no
t exist.
At line:1 char:12
+ Remove-Item <<<< "C:\foo\.svn"
+ CategoryInfo : ObjectNotFound: (C:\foo\.svn:String) [Remove-Item], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand
Hmm, this works for me. 嗯,这对我有用。 Are you sure the directory exists? 您确定目录存在吗? Perhaps it is hidden. 也许它是隐藏的。 If so try: 如果是这样,请尝试:
Remove-Item C:\foo\.svn -force -recurse
我确定其中一位大师的方法更简洁,但这应该可行:
gci | where {$_.name -match '.svn'} | remove-item
rm .test
为我工作,这里没有问题。
可能是由于权限不正确,尝试的一件事是添加-Force标志:
Remove-Item "C:\foo\.svn" -Force
Try this: 尝试这个:
Remove-Item C:\foo\.svn
or this: 或这个:
Remove-Item C:\foo\\.svn
Worked for me. 为我工作。
Make sure the file actually exists and doesn't have a extension you're not providing. 确保文件确实存在,并且没有您没有提供的扩展名。 Try listing the contents of the directory to it isn't the directory not found and that it actually contains the files you think it does. 尝试将目录的内容列出到找不到目录的位置,并且目录实际上包含您认为的目录。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.