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
  • Former Member
    Former Member $organization

    Ben, I have a feeling its a WINZIP license issue. Let me get that right and test because this works correctly from command prompt (I created a batch file) but with license renewal message…

     

    Thanks

    Varsha

     

    From: Tessitura Technical Forum [mailto:forums-technical@tessituranetwork.com] On Behalf Of Ben Gu
    Sent: Wednesday, 1 December 2010 4:58 PM
    To: Varsha Karnik
    Subject: RE: [Tessitura Technical Forum] Zipping a txt file

     

    one more thing. you can check the event log. see what else can be found.

    From: Varsha Karnik <bounce-varshakarnik2805@tessituranetwork.com>
    Sent: 11/30/2010 8:42:32 PM

    Now I get error that “System cannot find the path specified.”

     

    declare @cmd varchar(1000)

     

    set @cmd='"\\Dell\Tessitura\Source\WinZip\winzip32.exe" -a "\\Dell\Tessitura\Source\sso_pacingdata.zip" "\\Dell\Tessitura\Source\sso_pacingdata.txt"'

    select @cmd

    EXEC master..xp_cmdshell @cmd

     

     

    I changed T: drive to full path as I thought it may not recognise drive but still doesn’t work.

     

    Is it permission issue for xp_cmdshell? If so what should I check?

     

    Thanks

    Varsha

     

    From: Tessitura Technical Forum [mailto:forums-technical@tessituranetwork.com] On Behalf Of Ben Gu
    Sent: Wednesday, 1 December 2010 1:18 PM
    To: Varsha Karnik
    Subject: RE: [Tessitura Technical Forum] Zipping a txt file

     

    Hi Varsha,

     

    I agree with Ken, you can test it in cmd windows, and I think you should use option -a not -o too.

    this will work.

    declare @cmd varchar(1000)

    set @cmd='"T:\Source\WinZip\winzip32.exe" -a "T:\Source\sso_pacingdata.zip" "T:\Source\sso_pacingdata.txt"'
    select @cmd
    EXEC master..xp_cmdshell @cmd

     

    have fun

    Ben

     

    From: Ken McSwain <bounce-kenmcswain5454@tessituranetwork.com>
    Sent: 11/30/2010 7:42:32 PM

    But the first  question is – Does this command-line work if you run it from a batch file?

    If it doesn’t, then it’s not a SQL syntax problem, it’s a Winzip syntax problem.

     

    ...and I have a feeling –o is an extraction option code, rather than a compression option code. I’d try –a ( add) as the option code instead.

     

    Ken McSwain Business solutions Manager

    kmcswain@sydneyoperahouse.com

    T+61 2 9250 7876  F+61 2 9251 7821  M 0418 659 360

     

    SYDNEY OPERA HOUSE BENNELONG POINT

    GPO BOX 4274, SYDNEY NSW 2001, AUSTRALIA

    SYDNEYOPERAHOUSE.COM

     

     

    Please consider the environment before printing this email.
     =====This message is intended for the addressee(s) named and may contain confidential information.
     If you are not the intended recipient, please delete it and notify the sender.
     Views expressed in this email are those of the individual sender and are not necessarily the views of the Sydney Opera House Trust=====




    This message was sent automatically to you by www.tessituranetwork.com because you subscribed to the Tessitura Technical Forum. You may reply to this message to post to the Technical forum or visit the site to search, read and post to the forums. In the interest of keeping the forum posts from becoming cluttered, we encourage you to delete previous message text from your reply before sending. Thank you!




    This message was sent automatically to you by www.tessituranetwork.com because you subscribed to the Tessitura Technical Forum. You may reply to this message to post to the Technical forum or visit the site to search, read and post to the forums. In the interest of keeping the forum posts from becoming cluttered, we encourage you to delete previous message text from your reply before sending. Thank you!

Reply
  • Former Member
    Former Member $organization

    Ben, I have a feeling its a WINZIP license issue. Let me get that right and test because this works correctly from command prompt (I created a batch file) but with license renewal message…

     

    Thanks

    Varsha

     

    From: Tessitura Technical Forum [mailto:forums-technical@tessituranetwork.com] On Behalf Of Ben Gu
    Sent: Wednesday, 1 December 2010 4:58 PM
    To: Varsha Karnik
    Subject: RE: [Tessitura Technical Forum] Zipping a txt file

     

    one more thing. you can check the event log. see what else can be found.

    From: Varsha Karnik <bounce-varshakarnik2805@tessituranetwork.com>
    Sent: 11/30/2010 8:42:32 PM

    Now I get error that “System cannot find the path specified.”

     

    declare @cmd varchar(1000)

     

    set @cmd='"\\Dell\Tessitura\Source\WinZip\winzip32.exe" -a "\\Dell\Tessitura\Source\sso_pacingdata.zip" "\\Dell\Tessitura\Source\sso_pacingdata.txt"'

    select @cmd

    EXEC master..xp_cmdshell @cmd

     

     

    I changed T: drive to full path as I thought it may not recognise drive but still doesn’t work.

     

    Is it permission issue for xp_cmdshell? If so what should I check?

     

    Thanks

    Varsha

     

    From: Tessitura Technical Forum [mailto:forums-technical@tessituranetwork.com] On Behalf Of Ben Gu
    Sent: Wednesday, 1 December 2010 1:18 PM
    To: Varsha Karnik
    Subject: RE: [Tessitura Technical Forum] Zipping a txt file

     

    Hi Varsha,

     

    I agree with Ken, you can test it in cmd windows, and I think you should use option -a not -o too.

    this will work.

    declare @cmd varchar(1000)

    set @cmd='"T:\Source\WinZip\winzip32.exe" -a "T:\Source\sso_pacingdata.zip" "T:\Source\sso_pacingdata.txt"'
    select @cmd
    EXEC master..xp_cmdshell @cmd

     

    have fun

    Ben

     

    From: Ken McSwain <bounce-kenmcswain5454@tessituranetwork.com>
    Sent: 11/30/2010 7:42:32 PM

    But the first  question is – Does this command-line work if you run it from a batch file?

    If it doesn’t, then it’s not a SQL syntax problem, it’s a Winzip syntax problem.

     

    ...and I have a feeling –o is an extraction option code, rather than a compression option code. I’d try –a ( add) as the option code instead.

     

    Ken McSwain Business solutions Manager

    kmcswain@sydneyoperahouse.com

    T+61 2 9250 7876  F+61 2 9251 7821  M 0418 659 360

     

    SYDNEY OPERA HOUSE BENNELONG POINT

    GPO BOX 4274, SYDNEY NSW 2001, AUSTRALIA

    SYDNEYOPERAHOUSE.COM

     

     

    Please consider the environment before printing this email.
     =====This message is intended for the addressee(s) named and may contain confidential information.
     If you are not the intended recipient, please delete it and notify the sender.
     Views expressed in this email are those of the individual sender and are not necessarily the views of the Sydney Opera House Trust=====




    This message was sent automatically to you by www.tessituranetwork.com because you subscribed to the Tessitura Technical Forum. You may reply to this message to post to the Technical forum or visit the site to search, read and post to the forums. In the interest of keeping the forum posts from becoming cluttered, we encourage you to delete previous message text from your reply before sending. Thank you!




    This message was sent automatically to you by www.tessituranetwork.com because you subscribed to the Tessitura Technical Forum. You may reply to this message to post to the Technical forum or visit the site to search, read and post to the forums. In the interest of keeping the forum posts from becoming cluttered, we encourage you to delete previous message text from your reply before sending. Thank you!

Children
No Data