I am using the following code to zip a text file by using Cygwin. master.dbo.xp_cmdshell 'c:\apps\cygwin\bin\zip.exe -j "D:\ZipMe\TestZip\subdir1\random.zip" "D:\ZipMe\TestZip\subdir1\random.text"'

Now the problem is with the result that random.zip file also include the parent directories information. This code is working fine with old version but gave me odd result the verison ZIP 3.0. Please help me out there.

  • the -j command is what strips the paths, if you are already using it and it is not working, i do not know – Richie Frame Mar 31 '15 at 7:55

In some version of Cygwin the Zip command has bug a which cause the -j option fail when Win32 paths are specified, So convert to POSIX paths and try this code... c:\apps\cygwin\bin\zip.exe -j "/cygdrive/d/ZipMe/TestZip/subdir1/random.zip" "/cygdrive/d/ZipMe/TestZip/subdir1/random.text". Thanks.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.