如何使用powershell选择没有扩展名的文件 [英] How to select files that have no extension using powershell

查看:55
本文介绍了如何使用powershell选择没有扩展名的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的驱动器中有很多目录和文件,其中一些已损坏且没有文件扩展名.我想删除所有没有扩展名的文件.我试过 gci |其中 {$_.extension -eq ""}gci |其中 {$_.extension -eq "."} 和这些变体,但最终在驱动器上什么也没有.

I have a drive with lots of directories and files, some of which are broken and have no file extension. I would like to delete all of the files that do NOT have an extension. I have tried gci | where {$_.extension -eq ""} and gci | where {$_.extension -eq "."} and variations of those, but end up getting nothing or everything on the drive.

如果我看gci |的结果选择扩展 文件没有显示扩展名,就像一个目录,不知道去哪里.

If I look at the results of gci | select Extension the files show nothing for the extension, just like a directory, not sure where to go.

任何帮助将不胜感激.

推荐答案

gci -File -Recurse | ?{!($_.Extension)}

这篇关于如何使用powershell选择没有扩展名的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆