[英]How to distinguish folder and file without extensions?
I am trying to distinguish files without this extension from folders, how to distinguish them from each other in VB NET.我正在尝试将没有此扩展名的文件与文件夹区分开来,如何在 VB NET 中将它们彼此区分开来。 I have to differentiate them for logging.
我必须区分它们以进行日志记录。 File without extension generated from excel file modification, like this..
excel文件修改生成的没有扩展名的文件,像这样..
You can use something like this:你可以使用这样的东西:
Dim filesWithOutExtension As List(Of String) = IO.Directory.GetFiles("C:\Users\UserName\Documents\").Where(Function(el) New IO.FileInfo(el).Extension.Length = 0).ToList
There is a 2'nd parameter to GetFiles
called searchPattern
where you can specify "*."
GetFiles
有一个名为searchPattern
的第二个参数,您可以在其中指定"*."
. .
Dim filesWithoutExtension = System.IO.Directory.GetFiles("c:\temp\", "*.")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.