copy

  • 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

  • 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.

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply