Batch file to copy directories.

Posted on 2005-04-12
Medium Priority
Last Modified: 2010-04-17
I'm trying to set up a batch file for a user that will copy several folders from thier pc to another location on a server. This batch file would be run once a week and any previous information on the server would be overwritten.

I'm having a couple of problems. The first is that i was using the COPY command but it was only copying the files and not the directories. I believe the XCOPY command should sort this out (with some switches). The second is that the naming convention of the files & folders that they need to copy do not follow the DOS naming convention.

Is there a batch/VB script that can do this?

Thanks for you help

Question by:funkypsiko

Expert Comment

ID: 13761745
I think you can use quote "" like

xcopy "c:\program files\tara tatata\*.*" c:\here

Accepted Solution

jsturtz earned 2000 total points
ID: 13761884
i use several .bat files to copy data between folders on machines (even over the web), some examples might help, if you have any questions post back.  to see about the various / switches read the doc when you type xcopy/? from the dos prompt.

xcopy w:\* "\\jimobile\netdisk (n)\NewFolderw\"    /e /y /d /c /i /h /r  /exclude:c:\bin\xf.txt

xcopy \\\e\TMS\PRB\DATA\dests.dbf        z:\TMS\PRB\DATA\ /e /y /d /c /i /h /r

xcopy \* z:\NewFolder%1\   /e/s/y/d/c /exclude:xf.txt       here the xf.txt has a list of things to NOT copy, note the %1, this file is being called by another batch that sends the %1 value.  so i can use it to copy several different drives to individual folders on the z drive.

good luck.


Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
No other job is as rewarding and demanding as building an iPhone app is. It is not really in the hands of the developer for the success of an iPhone app. Many factors operate jointly for every iOS application's success in the market.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Screencast - Getting to Know the Pipeline

621 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