Basic/ C# (.NET)
C# - 파일, 폴더 존재 유무 확인
HappyWeasel
2019. 5. 9. 12:45
파일
string _Filestr = @"파일 경로";
System.IO.FileInfo fi = new System.IO.FileInfo(_Filestr);
if (fi.Exists){
존재 시 로직
}
else{
없을 시 로직
}
폴더
string sDirPath = @"폴더 경로";
DirectoryInfo di = new DirectoryInfo(sDirPath);
if (di.Exists == false)
{
di.Create();
}