find: paths must precede expression: find


Keywords:ubuntu 


Question: 

Running the following find:

find . -exec chown apache:janderson {} \; find . -type f -exec chmod 0664 && find . -type d -exec chmod 0775 {} \;

But it's generating this error:

find: paths must precede expression: find

How do I fix?


1 Answer: 

Are you trying to run find 3 times? Add a separator:

find . -exec chown apache:janderson {} \; && 
    find . -type f -exec chmod 0664 {} \; && 
    find . -type d -exec chmod 0775 {} \; 

You are missing the && between the first and second find calls. The ; does not act as a separator, but as an argument to find which serves to terminate the exec.