Batch file to copy directories.

Posted on 2005-04-12
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

    I think you can use quote "" like

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

    Accepted Solution

    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

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Suggested Solutions

    A short article about problems I had with the new location API and permissions in Marshmallow
    If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

    755 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

    23 Experts available now in Live!

    Get 1:1 Help Now