Zipping a txt file

Former Member
Former Member $organization

Hi

I'm trying to zip a Text file in SQL but once I run the command, sql keeps executing for long time and I don't get any error.

EXEC master..xp_cmdshell 'T:\Source\WinZip\winzip32.exe T:\Source\sso_pacingdata.zip T:\Source\sso_pacingdata.txt'

I also tried,

EXEC master..xp_cmdshell 'T:\source\WinZip\winzip32.exe -o T:\Source\sso_pacingdata.txt'

Probably my syntax is wrong. Can anyone please let me know the right syntax to Zip a Text file.

Thanks

Varsha

Parents
  • Hi Varsha,

    Good day.

    My winzip is expired, so I cannot do the test for you,

    but based on the web link http://www.memecode.com/docs/winzip.html

    I think the syntax should be:

    EXEC master..xp_cmdshell 'T:\Source\WinZip\winzip32.exe -o T:\Source\sso_pacingdata.zip T:\Source\sso_pacingdata.txt'

     

    you should tell sql what to run: winzip32.exe

    what is the option:  -o

    what is target file: sso_pacingdata.zip

    what is source file: sso_pacingdata.tx

     

    have fun.

    Ben

     

Reply
  • Hi Varsha,

    Good day.

    My winzip is expired, so I cannot do the test for you,

    but based on the web link http://www.memecode.com/docs/winzip.html

    I think the syntax should be:

    EXEC master..xp_cmdshell 'T:\Source\WinZip\winzip32.exe -o T:\Source\sso_pacingdata.zip T:\Source\sso_pacingdata.txt'

     

    you should tell sql what to run: winzip32.exe

    what is the option:  -o

    what is target file: sso_pacingdata.zip

    what is source file: sso_pacingdata.tx

     

    have fun.

    Ben

     

Children
No Data