stilts
Newbie
Posts: 1
Registered: 3/14/2007
Member Is Offline
|
| posted on 3/14/2007 at 04:47 PM |
|
|
Zipping files from different folders
Hi. Just bought AspZip and finding extremely useful. Struggling a bit with zipping multiple files from different folders into one zip though.
'create temporary file name for output zip file
FileName = Zip.GetTempFileName(Server.MapPath("zipFolder"), "test", ".zip")
'create new zip file
Zip.New(FileName)
'set root folder
Zip.RootDirectory = Server.MapPath("images/")
'add files to archive
Zip.FileList.Add("pic.jpg")
Zip.FileList.Add("anotherpic.jpg")
'save zip file
FileCount = Zip.Save
If I use this code all images have to be in the images folder. I tried resetting the root folder after each FileList.Add but just got 2nd image in
zip.
I want to be able to loop through a list of images and 'collect them' from several places in the site.
Any help much appreciated.
Stilts :)
|
|
|
wit
Member
Posts: 24
Registered: 11/19/2004
Member Is Offline
|
| posted on 3/14/2007 at 06:18 PM |
|
|
To add files from different folders just use absolute file paths when you add them to file list
e.g.
'create new zip file
Zip.New(FileName)
'add files to archive
Zip.FileList.Add(Server.MapPath("images/") & "pic.jpg")
Zip.FileList.Add(Server.MapPath("anotherfolder/") & "anotherpic.jpg")
'save zip file
FileCount = Zip.Save
|
|
|