Would like to copy every file from a directory structure to a specific directory only if file does not exist there already.
Got the first part from this Stack Overflow question:
find . -type f -exec cp {} /target-directory \;
How can I check if the file exists or not? If not, copy the file, otherwise skip.
Best Answer
You can use
-u
switch fromcp
command:or use
rsync
command with--ignore-existing
:Example: