Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: xcopy without replacement  (Read 3364 times)

0 Members and 1 Guest are viewing this topic.

elimenohpee

    Topic Starter


    Starter

    xcopy without replacement
    « on: June 14, 2010, 08:42:43 PM »
    I'm trying to write a .bat file (I just started learning msdos and scripting tonight so bear with me) that will backup/copy any new files placed on my jump drive onto my home computer.  To do this, right now I'm just running a xcopy command from the command line.  However, is there a switch that will tell dos not to copy if the file already exists and hasn't been modified?  I was able to copy all the files, but I thought it might be time consuming if everytime I plug it in it has to copy the ENTIRE jump drive, instead of the new files.

    /U seems to have exactly what I need, just opposite :)

    Thanks for any help

    T.C.



      Beginner

      Thanked: 13
      Re: xcopy without replacement
      « Reply #1 on: June 15, 2010, 02:29:27 AM »
      Have a look at the Xcopy /M switch.

      Hope this helps.

      elimenohpee

        Topic Starter


        Starter

        Re: xcopy without replacement
        « Reply #2 on: June 15, 2010, 10:02:24 AM »
        That didn't seem to work, it still asks me if I'd like to overwrite the file, which I don't.  Right now I'm using this as the script, which gets the job done, it just takes about 2 minutes to sync everything up.

        @echo off
        xcopy e:\jumpdrive c:\documents /s /m
        xcopy c:\documents e:\jumpdrive /s /m

        I'd like it to only copy new files, instead of copying 533 files (last run) each time it executes.  The switch /y seems like it should work, but it tells it to overwrite it, which is opposite of what I actually want also.

        elimenohpee

          Topic Starter


          Starter

          Re: xcopy without replacement
          « Reply #3 on: June 15, 2010, 10:09:22 AM »
          Figured it out.  If you use the switch /d without a date specified, it will copy only files that have changed at some point.  Works perfectly now.