Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using xp_cmdshell to copy files

Status
Not open for further replies.

LonnieJohnson

Programmer
Apr 16, 2001
2,628
US
I am writing a script for a trigger that will copy some files if a client record is closed when a certain date is entered. The code below works fine except for my subfolders.

Is there an easy way to copy those as well without getting into complicated recursive code?

If not, does anyone have any sample code?

Code:
Exec master.dbo.xp_cmdshell 
'Copy \\profile-ks-001\pool\Client_Files\test1\*.* 
\\profile-ks-001\pool\Client_Files\test2\*.*' 
Go

Thanks in advance.

ProDev, Builders of Affordable Software Applications
Visit me at ==>
May God bless you beyond your imagination!!!
 
erm, you could use xcopy instead of copy.

I'm assuming you're aware of all the security implications of allowing xp_cmdshell...

--------------------
Procrastinate Now!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top