ftl25 0 Junior Poster in Training

Hi. I have just downloaded infozip for integration with some of our vb6 software. I got it working however, when I check the zip folder, I see that a directory structure has been created for each path contained in the filenames. E.g., I have a list of files as follows:
C:\Temp\Message.txt
C:\Project\Example.txt
and I choose to zip these into a folder named "Test.Zip" in the C drive
The directory structure created is:
C:\Test.zip\Temp\Message.txt
C:\Test.zip\Project\Example.txt
I would prefer to just have both files sitting in the Test.zip folder.
Has anyone encountered this problem before? Any help appreciated.

Dani AI

Generated

— Info‑ZIP's zip stores whatever path you hand it. To keep only the filenames inside the archive, pass the -j (or --junk-paths) switch; that tells zip to discard directory components when adding files.

A simple VB6-friendly way is to call the zip executable with -j and proper quoting. Example (use the actual path to your zip.exe and your file names):

Dim cmd As String
cmd = """C:\Path\To\zip.exe"" -j ""C:\Test.zip"" ""C:\some\dir\fileA.txt"" ""C:\other\dir\fileB.txt"""
CreateObject("WScript.Shell").Run cmd, 0, True

Troubleshooting notes: make sure the command string points to the Info‑ZIP zip.exe you intend to run (full path and quotes matter). If you need to preserve a relative directory tree instead of flattening everything, change the current directory to the common parent (ChDrive/ChDir) and add files by relative path rather than using -j. Also beware: -j removes directory names, so files with identical basenames from different folders will collide — rename or keep relative paths if that’s a concern.

For the official option description see the zip manual (search for -j / --junk-paths): zip(1) manual.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.