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 ?
使用find,您可以执行以下操作:
find /where -name test.jpg -type f -exec cp -i /home/test.jpg {} \;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.