karldenton Posted October 15, 2009 Posted October 15, 2009 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\LettersHome\*.* \\2003server\d$\data\intranets\wamp\wamp\www\letters\*.* Doesn't work though. Am I missing something obvious !
Domino Posted October 15, 2009 Posted October 15, 2009 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....
Face-Man Posted October 15, 2009 Posted October 15, 2009 DOS won't like spaces in path and doesn't need the *.* at the end of the destination
jamesreedersmith Posted October 15, 2009 Posted October 15, 2009 Try copy "\\2003server\sharedarea\_Teacher Admin\LettersHome\*.*" "\\2003server\d$\data\intranets\wamp\wamp\www\letters\*.*" Thanks James
karldenton Posted October 15, 2009 Author Posted October 15, 2009 No the spaces don't exist - just happened when i copied to here. The only space is between _Teacher Admin hence the %20
DSapseid Posted October 15, 2009 Posted October 15, 2009 i use this when ever i have to do a copy xcopy "\\server\share\folder" "\\server\share\folder2" /s /c /i
sharkster Posted October 15, 2009 Posted October 15, 2009 (edited) try this xcopy \\2003server\sharedarea\_TEACH~1\LettersHome\*.* \\2003server\d$\data\intranets\wamp\wamp\www\letters\*.* edit - or this net use Y: \\2003server\sharedarea\_TEACH~1\LettersHome net use Z: \\2003server\d$\data\intranets\wamp\wamp\www\letters 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 Edited October 15, 2009 by sharkster
karldenton Posted October 15, 2009 Author Posted October 15, 2009 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?
OutToLunch Posted October 15, 2009 Posted October 15, 2009 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.
OutToLunch Posted October 15, 2009 Posted October 15, 2009 Robocopy does provide a sync facility. Never noticed that switch before! I assume that means leaving a console/robocopy Window open all the time on the server though?
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now