File not found Exception.. But it's there

前端 未结 4 935
没有蜡笔的小新
没有蜡笔的小新 2021-02-18 14:17

Hey this is going to be one of those dumb questions. I am trying to pick up a file on my local system and I keep getting a FileNotFoundException thrown.

Som

4条回答
  •  庸人自扰
    2021-02-18 14:55

    Try doing Directory.GetFiles(@"C:\logs"). It's possible that the file in question has odd characters that are getting interpreted one way by Windows Explorer (presumably where you're reading "the file's property" from?) but a different way by the .NET Framework. This can happen if you have UTF-8 characters in the filename (perhaps an en dash?).

提交回复
热议问题