Copy only missing files

Let me preface this question by saying that I am relatively new to writing batch files, so I apologize if my question seems to be fixed.

I am trying to transfer files from a directory to a shared drive that I have mapped. I know that using "XCOPY c: \ etc .. z: \ etc ../ Y" will copy everything from one place to another, but what I don't want to do is overwrite each file every time. Is there a way to copy only files that are not in the destination directory?

+3
source share
1 answer

solution 1:

xcopy  /d/y

must work..........

enter image description here

decision 2

echo "No" | copy/-Y c:\source c:\Dest\

works. testing

2 folders have the same files, allow you to try to copy.

 C:\r\Roi>echo "No" | copy/-Y  . 2
.\DSpubring.pkr
Overwrite 2\DSpubring.pkr? (Yes/No/All): "No"
Overwrite 2\DSpubring.pkr? (Yes/No/All):
.\DSsecring.skr
Overwrite 2\DSsecring.skr? (Yes/No/All):
        0 file(s) copied.

allows you to create 1 new file

C:\r\Roi>copy con g.txt
sdfsdf
^Z
    1 file(s) copied.

:

C:\r\Roi>echo "No" | copy/-Y  . 2
.\DSpubring.pkr
Overwrite 2\DSpubring.pkr? (Yes/No/All): "No"
Overwrite 2\DSpubring.pkr? (Yes/No/All):
.\DSsecring.skr
Overwrite 2\DSsecring.skr? (Yes/No/All):
.\g.txt
        1 file(s) copied. <------------ one file only
+5

All Articles