?
Solved

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

Posted on 2008-06-18
5
Medium Priority
?
1,733 Views
Last Modified: 2010-04-21
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.

Thanks
0
Comment
Question by:mcse63
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 38

Accepted Solution

by:
Shift-3 earned 1000 total points
ID: 21813413
Robocopy, from the Server 2003 Resource Kit, is generally a better option for copying directories and large amounts of data.
http://www.microsoft.com/downloads/details.aspx?familyid=9d467a69-57ff-4ae7-96ee-b18c4790cffd

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

0
 

Author Comment

by:mcse63
ID: 21813593
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.

thanks,
0
 
LVL 38

Expert Comment

by:Shift-3
ID: 21813765
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?
0
 

Author Comment

by:mcse63
ID: 21814035
I can create and or copy without a problem.

I use commmand line and get invalid number of parameters.
0
 

Author Closing Comment

by:mcse63
ID: 31468362
Thanks for the help, there was a dns issue, once I put in the ip it worked without a hitch.
0

Featured Post

Application Discovery Service in AWS

In the era of the cloud, customers migrating away from their existing on-premise infrastructure. This requires lots of planning, strategies, and effort to identify their existing resources and determine how best to migrate.  Datacenter migrations happen in four phases -

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show, step by step, how to integrate R code into a R Sweave document
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question