Question:

# How to add a directory to a ZIPfile?

##### Aug 03 '12 at 07:44

Hi,

maybe a simple question, but I can't find the solution.

I'm trying to add a file (for e.g. c:\temp\Thisfile.txt) to a zipfile, but under the directory TXT in the ZIPfile (and rename it if possible).

So c:\temp\Thisfile.txt needs to be in TXT\file.txt in the ZIPfile. Is this possible ?

I tried 'ZIP.appendonefileordir("c:\temp\Thisfile.txt",0) but then the file is created in the root.

Many thanks Glenn