Need a Batch file to copy a folder from 1 location to another.

I would like to create a batch file to copy files from one share to another share. OS's involved Win2000/xpPro and w2003

I have tried as a test from my local machine
@echo off
xcopy c:\folder \\server\share\folder with no success
Copying the folder the same drive in a different folder is not a problem.

Any help or insight would be greatly appreciated.

Who is Participating?
Shift-3Connect With a Mentor Commented:
Robocopy, from the Server 2003 Resource Kit, is generally a better option for copying directories and large amounts of data.

But if you want to use XCOPY then the below should work.

@echo off
xcopy "c:\folder\*.*" "\\server\share\folder\" /E /C /H /R /Y /Z

Open in new window

mcse63Author Commented:
I have tried the above code and the folder is not being copied. I tried a few variations but nada. I should also point out that I would like to be able to run this from my local machine. ie. an desktop shortcut. I am currently mapped to the drive that I want to copy the folder to and have admin permissions.

Are you able to create a folder on that share and copy files to it through Windows Explorer?

Either run the script from the command line or add a "pause" line to the end.  What error do you get?
mcse63Author Commented:
I can create and or copy without a problem.

I use commmand line and get invalid number of parameters.
mcse63Author Commented:
Thanks for the help, there was a dns issue, once I put in the ip it worked without a hitch.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.