디렉토리를 생성할때 디렉토리가 생성되어 있는지 검사도 해야 한다.
Directory 나 DirectoryInfo 를 사용하면 디렉토리 생성 및 검사도 가능하다.
|
방법#1 |
if (Directory.Exists(rootPath) == false) Directory.CreateDirectory(rootPath); |
|
방법#2 |
DirectoryInfo di = new DirectoryInfo(rootPath); if (di.Exists == false) { di.Create(); } |

Prev
Rss Feed