Click or drag to resize

AddFolder 메서드

ZIP 파일에 지정된 폴더를 추가합니다.

형식
syntax
retCode = objZipFile.AddFolder(srcName, folderName)

objZipFile

Required. ZipFile 오브젝트

retCode

Long. 작업에 대한 결과 코드를 반환합니다. 성공일 경우 0을 반환하며 실패일 경우 오류 코드를 반환합니다.

folderName

String. ZIP 파일에 추가할 폴더를 지정합니다.

설명

ZIP 파일 내부에 폴더를 추가합니다. 추가한 폴더에 파일을 추가하기 위해서는 AddFileEx 메서드를 호출해서 ZIP 내부에서 저장할 위치를 지정하도록 합니다. 아래 예제는 서브 폴더를 생성하고 해당 폴더에 파일을 추가하는 방법을 보여줍니다.

예제
ASP
Set zip = Server.CreateObject("TABSUpload4.ZipFile")
If zip.Create("D:\zipped\sources.zip", "") Then
    '루트 폴더에 저장
    zip.AddFileEx "D:\Source\file1.htm", "파일1.htm"
    zip.AddFolder "서브 폴더"
    zip.AddFile "D:\Source\file2.htm", "서브 폴더\파일2.htm"    
    zip.AddFolder "서브 폴더\서브 폴더2"
    zip.AddFile "D:\Source\file3.htm", "서브 폴더\서브 폴더2\파일3.htm"
    zip.Close
    Response.Write "ZIP 파일을 성공적으로 생성하였습니다."
Else
    Response.Write "ZIP 파일을 생성할 수 없습니다."
End If