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 2005 Forums
 Other SQL Server Topics (2005)
 Batchfile

Author  Topic 

benni
Starting Member

4 Posts

Posted - 2011-04-28 : 15:25:33
Hi, I have to schedule a batchfile in sql server 2005 to copy files from one server to another remote server.
I'm using the below statement and it is not happening the process.And, to login to server2 i have to use
username and password. so , how could i add the username and password in the below statement to auto process
it. Is the statement enough to do the process.Please help. thanks.

xcopy /e /v /y \\server1\Prod_Output\New_files //server2/Docs/Reports/FTPfolder

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-04-28 : 15:29:35
I use CPAU.exe to pass in credentials: http://www.joeware.net/freetools/tools/cpau/index.htm

Regarding your problem though, //server2/Doc/... is not correct. The slashes need to be backslashes. Plus you need to specify *.* in the server1 path.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

benni
Starting Member

4 Posts

Posted - 2011-04-28 : 15:49:55
Thanks and is this syntax correct ?
CPAU \\server1\Prod_Output\New_files\*.* -u server2\UserName -p password -ex \\Docs\Reports\FTPfolder

or is there any way can i pass the username/password in the xcopy command.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-04-28 : 16:15:12
Did you download CPAU?

Here's what mine looks like:
E:\folder\CPAU\CPAU.exe -u DomainName\UserName -p Password -ex "xcopy \\server1\shareName\fileName.txt E:\folder1\ /Y" -nowarn -wait -hide


Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

benni
Starting Member

4 Posts

Posted - 2011-04-28 : 16:57:26
Thanks a lot and i'm trying it , i would let you know ....
Go to Top of Page
   

- Advertisement -