Let me preface this question by saying that I am relatively new to writing batch files, so I apologize if my question seems remedial.
I'm trying to move 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 every file every time. Is there a way to copy just the files that are not located in the destination directory?
xcopy /d/y
should work..........
echo "No" | copy/-Y c:\source c:\Dest\
working. tested
2 folders have the same files , lets 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.
lets create 1 new file
C:\r\Roi>copy con g.txt
sdfsdf
^Z
1 file(s) copied.
lets 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):
.\g.txt
1 file(s) copied. <------------ one file only
You can also do
robocopy /xc /xn /xo /s source destination
Answer take from here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With