sadanand munswamy wrote:Hi Rob,
Many thanks, for your prompt reply. But i am still not getting it worked as per my need,
Have been trying to tweak the API for a long time now. Can you please be a little more elaborate.
If I take your example of zipping folder
C:\dir1\dir2\dir3 from
this thread.
Assume that inside
dir3 there are files
file1 and
file2, and sub directory
dir4 with files
file3 and
file4.
I will then start by calling
addToZip with a File object for
C:\dir1\dir2\dir3 and a name of "".
The method will see that the
file argument is a directory. It will then iterate over its sub folders and files (let's call these
f). This will cause method calls
addToZip(stream, f, "file1"),
addToZip(stream, f, "file2") and
addToZip(stream, f, "dir4").
The first two method calls will end because the
file argument will not be a directory.
The third one will see that the
file argument is a directory, and iterate over its contents again. It will now call
addToZip(stream, f, "dir4/file3") and
addToZip(stream, f, "dir4/file4").
As a result, the ZIP file will contain the following files:
- file1
- file2
- dir4/file3
- dir4/file4