November 8, 2007 at 10:24 am
Hi,
I have a folder in my server location C:/temp/Ouput.
I have to schedule a job which will call a stroed procedure to zip the file called Output and store it in the same temp folder.
How can i do that?
Thanks,
Rama
November 8, 2007 at 10:32 am
xp_cmdshell can be used to execute DOS commands. SO assuming you have zip software installed that has a command line version (like Winzip or 7-Zip and I'm sure others as well) you can execute the require command as a parameter to xp_cmdshell.
You must ensure that xp_cmdshell is enabled and you have authority to use it.
Francis
November 8, 2007 at 10:33 am
That will vary based on your zip program, but something like this ought to get you started.
I think this will work for PKZIP, but I didn't look up the exact command line syntax.
DECLARE @CMD VARCHAR(512)
SET @CMD = 'C:\PKZIPC\PKZIPC.exe -add d:\folder\destination.zip d:\folder\source.txt '
EXECUTE xp_cmdshell @CMD
I might have the destination and source parameters reversed...don't remember
The Redneck DBA
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy