Programming/C# - Window

C#/ 압축파일 만들기

esoog Polaris 2023. 12. 3. 22:30
반응형
using System.IO.Compression;

public void ZipFolder(string sourceFolder, string zipFilePath)
{
    try
    {
        if (File.Exists(zipFilePath))
        {
            File.Delete(zipFilePath); // 덮어쓰기 위해 기존 파일 삭제
        }

        ZipFile.CreateFromDirectory(sourceFolder, zipFilePath);
    }
    catch (Exception ex)
    {

    }
}
728x90

'Programming > C# - Window' 카테고리의 다른 글

C#/ unsafe 키워드  (0) 2023.12.08
C#/ FTP 파일 서버 사용하기  (0) 2023.12.03
C#/ 디렉터리 및 파일 copy와 delete  (0) 2023.12.03
C#/ 타이머 핸들러 사용(Timer)  (0) 2023.12.02
C#/ 레지스트리 등록 사용  (0) 2023.12.02