[英]c# How to get all files in a folder regardless of their file type
I am trying to retrieve all the file paths in a specific folder location. 我正在尝试检索特定文件夹位置中的所有文件路径。 I use the Directory.GetFiles("path of folder containing files") method, but it only detects files of type "File", and not files such as "ATC File".
我使用Directory.GetFiles(“包含文件的文件夹路径”)方法,但它仅检测类型为“ File”的文件,而不检测诸如“ ATC File”之类的文件。 The files have no extentions.
文件没有扩展名。
Is there a way of retrieving all files regardless of their type? 有没有一种检索所有文件的方法,而不管它们的类型如何? If possible folders (of type "File Folder") should not be detected.
如果可能,不应检测到文件夹(“文件夹”类型)。
I use the following code: 我使用以下代码:
string[] filesInSelectedFolder = Directory.GetFiles(fileLocation);
string[] filePaths = Directory.GetFiles(@"c:\MyDir\", "*.bmp",
SearchOption.AllDirectories);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.