I want to do a very similar thing than here . The difference is that I want to copy only the files containing specific string in their name (eg file_00).
Using the answer from this post , I tried this :
cp -a /home/folder_1/. find . -name "*file_00*" - print /home/folder_2
But the function cp doesn't recognize the function find
. Then I tried
cp -a /home/yanncochet/folder_1/. -e'file_00' /home/yanncochet/folder_2
But same error message. Can anyone help ?
find
is a separate program from cp
. What I think you were trying to do was use find as input for cp. You can use command substitution for that:
cp $(find directory/ -name "*file_00*") destination/
$(...)
basically runs the command inside and returns it's output.
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.