File (2) 썸네일형 리스트형 [C#] 파일 삭제 class Lesson { public Lesson() { // 디렉토리 생성 CreateDir(@"C:\TestDir"); // 파일 생성 CreateFile(@"C:\TestDir\File.txt"); // 파일 삭제 DeleteFile(@"C:\TestDir\File.txt"); } // 디렉토리 생성 private void CreateDir(string dirPath) { // 해당 경로에 존재하지 않는 디렉토리들 생성 System.IO.Directory.CreateDirectory(dirPath); } // 파일 생성 private void CreateFile(string filePath) { System.IO.File.Create(filePath).Close(); } // 파일 삭제 priva.. [C#] 파일 생성 class Lesson { public Lesson() { // 파일 생성 CreateFile(@"C:\MainDir\File1.txt"); CreateFile(@"C:\MainDir\File2.txt"); } // 파일 생성 private void CreateFile(string filePath) { // 해당 경로가 존재하지 않으면 예외 발생. System.IO.File.Create(filePath).Close(); } } 설명 생략 2023.10.07 - [C#] - [C#] 폴더 (디렉토리) 생성 [C#] 폴더 (디렉토리) 생성 class Lesson { public Lesson() { // 메인디렉토리와 서브디렉토리 생성 CreateDir(@"C:\MainDir\SubDir"); } // 디렉토.. 이전 1 다음