0

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 (e.g. 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 ?

Y.Coch
  • 331
  • 4
  • 13

1 Answers1

0

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.