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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Zipping Subfolder using xp_cmdshell
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

2 Posts

Posted - 09/10/2013 :  09:51:45  Show Profile  Reply with Quote
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\" "C:\Users\Test""'
exec master..xp_cmdshell @cmdd,no_output

Not sure where going wrong in the above..

Most Valuable Yak

15732 Posts

Posted - 09/10/2013 :  20:37:19  Show Profile  Visit robvolk's Homepage  Reply with Quote
I think you have an extra set of quotes, try this:
select @cmdd = '"C:\Program Files\WinZip\wzzip.exe" -a -r "C:\Users\" "C:\Users\Test"'
exec master..xp_cmdshell @cmdd,no_output
Go to Top of Page

Starting Member

2 Posts

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

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

Flowing Fount of Yak Knowledge

8781 Posts

Posted - 09/13/2013 :  08:09:35  Show Profile  Visit webfred's Homepage  Reply with Quote
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
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000