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 2000 Forums
 SQL Server Development (2000)
 using DOS command XCopy with xp_cmdshell

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-01-31 : 09:10:08
Khalil writes "I am trying to use the DOS command XCOPY with xp_cmdshell.

EXEC master..xp_cmdshell 'XCOPY \\networkpath\folder\file \\networkpath\folder.

I need to use XCopy because folders which exist in the source path may not exist on the destination path. Thus XCopy will make sure that the folders which do not exist on the destination folder will be created. I am able to move, copy, del etc but XCopy does not work.

Please send me some ideas as to why this may not be working or even a possible work around to this problem.

Thanks,

Khalil Virji "

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-01-31 : 09:17:10
Usually this is a network or OS rights issue. When xp_cmdshell runs, it executes under SQL Server's login account (the account the MSSQLServer service starts with). If that account does not have rights to the drives or folders Xcopy is accessing, it will most likely fail. Double-check the rights and try modifying them and see if that clears it up.

Go to Top of Page
   

- Advertisement -