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
 Other Forums
 Other Topics
 xcopy

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-02-27 : 12:01:16
Denise writes "I'm trying to add a step to a backup job to copy the backup files to another server. I keep getting a syntax erroror near '\' though. Can anyone help me see what is wrong with this statement:
xcopy D:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\HCLL_Production_DB\*.* \\HCLLTEST\D$\Program Files\Microsoft SQL Server\MSSQL\BACKUP\*.* /d /s

Thanks for any ideas!"

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2006-02-27 : 12:16:54
I'm guessing you are running this with xp_cmdshell.. If so then you need quotes around it in a job:


master..xp_cmdshell "xcopy D:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\HCLL_Production_DB\*.* \\HCLLTEST\D$\Program Files\Microsoft SQL Server\MSSQL\BACKUP\*.* /d /s"


Hopr this helps
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-02-27 : 12:27:10
I think it may be worse even that that RickD!

Because there are spaces in the Path I expect that that too has to be preserved.

I'm not sure but this might work:

xcopy "D:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\HCLL_Production_DB\*.*" "\\HCLLTEST\D$\Program Files\Microsoft SQL Server\MSSQL\BACKUP\*.*" /d /s

Kristen

Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2006-03-06 : 22:34:55
use the dos filename

program files = progra~1
microsoft sql... = micros~1

HTH

--------------------
keeping it simple...
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2006-03-07 : 08:47:35
quote:
Originally posted by jen

use the dos filename

program files = progra~1
microsoft sql... = micros~1

HTH

--------------------
keeping it simple...



Not a good idea ... use the proper filenames.
Go to Top of Page
   

- Advertisement -