728x90
반응형
1. File Copy


private void Form1_Load(object sender, EventArgs e)
{
string ori_File = @"C:\copytest\test_ori.txt";
string new_file = @"C:\copytest\test_new.txt";
System.IO.File.Copy(ori_File, new_file);
}

2. File Delete
private void Form1_Load(object sender, EventArgs e)
{
string ori_File = @"C:\copytest\test_ori.txt";
string new_file = @"C:\copytest\test_new.txt";
//System.IO.File.Copy(ori_File, new_file);
System.IO.File.Delete(new_file);
}

3. File Move
기존에 test_ori.txt 파일은 C:\copytest\test_ori.txt 경로에 있고 ,

movetest 폴더는 비어있다.

private void Form1_Load(object sender, EventArgs e)
{
string ori_File = @"C:\copytest\test_ori.txt";
string new_file = @"C:\copytest\movetest\test_ori.txt";
//System.IO.File.Copy(ori_File, new_file);
System.IO.File.Move(ori_File,new_file);
}
test_ori.txt 파일이 movetest 폴더로 이동된다.


728x90
반응형
'c# > 기타' 카테고리의 다른 글
[c#] 시간 측정 stopwatch (0) | 2022.03.18 |
---|---|
[c#] List<string> 특정 단어가 들어가면 삭제 (0) | 2022.01.21 |
[c#] Excel Read , 속도 개선, OleDbConnection 사용 (1) | 2022.01.12 |
[c#] 일반화 메소드 , 한 개 함수로 여러 타입 사용 (0) | 2021.12.27 |
[c#] 다른 함수에서 배열값 변경 (0) | 2021.12.24 |