Pablo :
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?
anubhava :
You may use it like this:
find /HOME/main/f1/subf1 -iname "*string*" -exec cp {} /HOME/main/ \;
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=353146&siteId=1