I try to find a way to copy and replace files recursively.
Example:
Folder /home/test/
1/test.jpg 1/sth_other.png 2/test.jpg 2/sth_other.jpg 3/test.jpg 4/test.jpg
You can see that in folder /home/test I have more and more folders (1,2,3,4) which file name ‘test.jpg’.
I have a file /home/test.jpg
Question:
How to replace file ‘test.jpg’ in 1/2/3/4(folders) with file /home/test.jpg ?
Advertisement
Answer
With find, you could do:
find /where -name test.jpg -type f -exec cp -i /home/test.jpg {} ;