Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Zipping Subfolder using xp_cmdshell

Author  Topic 

baish
Starting Member

2 Posts

Posted - 2013-09-10 : 09:51:45
Hi,
For past few days i have been trying to figure out on how to zip my subfolders using xp_cmdshell. I have tried finding out in Google but no help.
I am using the below code:

select @cmdd = '""C:\Program Files\WinZip\wzzip.exe" -a -r "C:\Users\Testing.zip" "C:\Users\Test""'
exec master..xp_cmdshell @cmdd,no_output

Not sure where going wrong in the above..

robvolk
Most Valuable Yak

15732 Posts

Posted - 2013-09-10 : 20:37:19
I think you have an extra set of quotes, try this:
select @cmdd = '"C:\Program Files\WinZip\wzzip.exe" -a -r "C:\Users\Testing.zip" "C:\Users\Test"'
exec master..xp_cmdshell @cmdd,no_output
Go to Top of Page

baish
Starting Member

2 Posts

Posted - 2013-09-13 : 07:57:29
No , even with
select @cmdd = '"C:\Program Files\WinZip\wzzip.exe" -a -r "\\Image2\scannedimages\Test.zip" "\\Image2\scannedimages\Test"'
print @cmdd
exec master..xp_cmdshell @cmdd,no_output

it doesnt zip the files..
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2013-09-13 : 08:09:35
copy the print output and paste it into a dos box - does it work?


Too old to Rock'n'Roll too young to die.
Go to Top of Page
   

- Advertisement -