class Lesson
{
public Lesson()
{
// 디렉토리 생성
CreateDir(@"C:\TestDir");
// 디렉토리 이름 변경
ModifiedDirName(@"C:\TestDir", @"C:\ModifiedDir");
// 디렉토리 생성
CreateDir(@"C:\MainDir");
// 디렉토리 이동 (ModifiedDir 폴더가 MainDir 폴더 내부로 이동)
ModifiedDirName(@"C:\ModifiedDir", @"C:\MainDir\ModifiedDir");
}
// 디렉토리 생성
private void CreateDir(string dirPath)
{
// 해당 경로에 존재하지 않는 디렉토리들 생성
System.IO.Directory.CreateDirectory(dirPath);
}
// 디렉토리 이름 변경
private void ModifiedDirName(string orgDirPath, string modifiedDirPath)
{
System.IO.Directory.Move(orgDirPath, modifiedDirPath);
}
}
- 직관적이고 간단해서 설명 생략
2023.10.07 - [C#] - [C#] 폴더 (디렉토리) 생성
2023.10.07 - [C#] - [C#] 폴더 (디렉토리) 존재 여부 확인
2023.10.07 - [C#] - [C#] 파일 생성
2023.10.07 - [C#] - [C#] 해당 폴더 (디렉토리) 의 내부 정보 가져오기
2023.10.07 - [C#] - [C#] 파일 이동, 이름 변경
2023.10.07 - [C#] - [C#] 디렉토리 삭제
'C#' 카테고리의 다른 글
[C#] 폴더 (디렉토리) 삭제 (0) | 2023.10.07 |
---|---|
[C#] 파일 이동, 이름 변경 (0) | 2023.10.07 |
[C#] 해당 폴더 (디렉토리) 의 내부 정보 가져오기 (0) | 2023.10.07 |
[C#] 파일 생성 (0) | 2023.10.07 |
[C#] 폴더 (디렉토리) 존재 여부 확인 (0) | 2023.10.07 |