January 28, 2008 at 4:52 am
Hi All,
I want to copy a folder from one server to another using XP_CMDSHELL command.The folder contains many number of folders.HOw can i acheive that.Please help, TIA
January 29, 2008 at 4:57 am
You need to learn DOS commands. XCopy is probably your best bet.
Also, you'll need to make sure that:
A) Xp_Cmdshell is enabled on your SQL Server (check the SQL Server Surface Area Configuration Tool)
B) The user you are running this job as has READ/WRITE permissions on both servers & UNC shares. It probably has to be a Windows Domain account that has access to SQL Server. A normal SQL Server Login doesn't usually cross servers like that unless you've set up linked servers and that's a whole nother topic.
C) That both servers trust each other (talk to your server admin)
D) That both servers can communicate with each other (i.e., there's no firewall or other object in the way -- talk to your network admin)
Once you have all the above verified and checked, you should just be able to copy over. You might need to use a .bat file and run that instead. Or you might want to check into FTP, which is probably a lot safer than XP_CMDShell.
With FTP, you can shove the Folder with its folders into a .zip file, send the .zip file to the new location, then have something on the new server extract the folder and all its children to the proper UNC Share.
Just a few thoughts.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply