Solved

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

Posted on 2008-06-18
5
1,713 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
  • 3
  • 2
5 Comments
 
LVL 38

Accepted Solution

by:
Shift-3 earned 250 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

815 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now