I want to COPY and REPLACE files from one folder to another, but I cant seem to get it to work
copy D:\FolderPath\Pictures\test.txt C:\Users\FolderPath\Desktop\test\test*.txt
pauseAny help would be much appreciated.
2 Answers
For your immediate concern, you want to move that wildcard to your source, not your destination, and just list the target directory as your destination. Also, tack a "/Y" option on the end to automatically overwrite files in the destination. So something like this should work:
copy D:\FolderPath\Pictures\test*.txt C:\Users\FolderPath\Desktop\test /YIf you are copying entire directories, then you might want to step up to ROBOCOPY as it has a great many options that can handle most any situation you can imagine, including overwriting, not overwriting, not adding new files, and purging old files when new ones are absent. You can read more about it here.
2To copy while changing the name from test1.txt to test.txt, do:
copy D:\FolderPath\Pictures\test1.txt C:\Users\FolderPath\Desktop\test\test.txt