Wednesday, April 27, 2022

[SOLVED] find: paths must precede expression: find

Issue

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?


Solution

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.



Answered By - William Pursell
Answer Checked By - Timothy Miller (WPSolving Admin)