Check if a folder exist in a directory and create them using C#

前端 未结 7 847
青春惊慌失措
青春惊慌失措 2020-12-01 02:44

How can I check if directory C:/ contains a folder named MP_Upload, and if it does not exist, create the folder automatically?

I am using V

7条回答
  •  情深已故
    2020-12-01 03:04

    You can try this..

    using System.IO;string path = "C:\MP_Upload";if(!Directory.Exists(path)){
       Directory.CreateDirectory(path);}
    

提交回复
热议问题