I have a directory called main. This directory is located in the root I mean the path to this directory is like this: /HOME/main
Inside this directory there is a folder called f1 and inside it another folder called subf1, so the path is like this: /HOME/main/f1/subf1
I want to check if there is a file in subf1 with a name containing a special string and copy this file to the main directory. I use this:
find . -maxdepth 1 -name "*string*" -exec cp {} ../main \;
It's incomplete and I don't know how to check if condition here, but even when I execute this command in /HOME/main/f1/subf1 path, it doesn't work. what's wrong?