Dos Copy Command
There might be a really simple answer to this but I'm missing something ! I want to use a batch file to copy the contents of one folder to another. Simples.
Batch file :
copy \\2003server\sharedarea\_Teacher%20Admin\LettersHo me\*.* \\2003server\d$\data\intranets\wamp\wamp\www\lette rs\*.*
Doesn't work though. Am I missing something obvious !
I assume the spaces in the file locations aren't present in your actual command?
I've always found robocopy to be much more reliable anyway....
DOS won't like spaces in path and doesn't need the *.* at the end of the destination
copy "\\2003server\sharedarea\_Teacher Admin\LettersHome\*.*" "\\2003server\d$\data\intranets\wamp\wamp\www\lett ers\*.*"
No the spaces don't exist - just happened when i copied to here. The only space is between _Teacher Admin hence the %20
i use this when ever i have to do a copy
xcopy "\\server\share\folder" "\\server\share\folder2" /s /c /i
xcopy \\2003server\sharedarea\_TEACH~1\LettersHome\*.* \\2003server\d$\data\intranets\wamp\wamp\www\lette rs\*.*
edit - or this
net use Y: \\2003server\sharedarea\_TEACH~1\LettersHome
net use Z: \\2003server\d$\data\intranets\wamp\wamp\www\lette rs
xcopy Y:\*.* Z:\ /d/e
net use Y: /del
net use Z: /del
the /d/e switch make it copy all folders within that directory and also any files that have been modified
- 2nd edit
this does add spacces inbetween the word "letters" so make sure ya dont copy that acrross
Thanks. Managed to get it to work now. Is there a way to sync the folder. Got it to copy one way. If the file is deleted in the original folder is there a way to delete the file in the copied folder too?
Not automatically - but you could script it using robocopy instead of xcopy, this has a mirror command which will delete files as needed to make each folder identical.
Never noticed that switch before! I assume that means leaving a console/robocopy Window open all the time on the server though?
Originally Posted by jinnantonnix
+1 recommendation for Robocopy here...