Using Directory.Getfiles with specifing the absolute path

前端 未结 3 1765
一向
一向 2021-01-13 14:17

Hi I wonder if you guys could help please.

I\'m writing a application that is going to live on multiple servers and therefore multiple IP\'s and instead of using the

3条回答
  •  说谎
    说谎 (楼主)
    2021-01-13 15:14

    Use Path.GetFullPath to get the absolute path from your relative path.

    So, your code becomes:

    string[] filePaths = Directory.GetFiles(Path.GetFullPath(@"..\BlogEngine\"), "*.xml");
    

提交回复
热议问题