xp_cmdshell to ZIP and rename a file RRS feed

  • Question

  • Hi All

    I have doubt using xp_cmdshell in SQL server.

    I want to ZIP a file using the 7 ZIP exe and rename the file with yesterdays date.

    To ZIP the file it doesnt work out for me well.

    result.csv is the file i want to zip and rename it with yesterdays date.

    exec master..xp_cmdshell 'C:\Program Files\7-Zip\7zG.exe e "C\temp\result.csv" -o "C\temp\"'

    I get this below error.


    'C:\Program' is not recognized as an internal or external command,
    operable program or batch file.

    I tried will all possible combination but no luck.

    Please advise me is the syntax is correct and let me know how to rename with yesterdays date too please.

    Thanks a lot in advance.

    Tuesday, October 16, 2012 1:51 PM


All replies