C#,Delphi,Oracle,MSSQL 개발자블로그

C# 폴더, 파일유무 확인 본문

Programming/C#

C# 폴더, 파일유무 확인

19760323 2017. 6. 14. 18:05

- 폴더체크

 

System.IO.DirectoryInfo di = new System.IO.DirectoryInfo("폴더경로");

if(di.Exists)

{

// 폴더 존재

}

else

{

//폴더 없음

 

 

- 파일 체크

 

string _Filestr = "파일 경로";

System.IO.FileInfo fi = new System.IO.FileInfo(_Filestr);

if(fi.Exists)

{

// 파일 존재

}

else

{

// 파일 없음

}

 

 

출처 : http://lhh3520.tistory.com/66

Comments