Rakesh
Rakesh

Reputation: 77

find: paths must precede expression: 2

$ find .  -type f -depth 2  -iname '2mm*'
find: paths must precede expression: 2

What is wrong with this command?

Upvotes: 2

Views: 414

Answers (1)

John Kugelman
John Kugelman

Reputation: 361605

-depth enables depth-first searching. It doesn't take any arguments. You probably want -mindepth 2 or -maxdepth 2.

From the find(1) man page:

-depth

Process each directory's contents before the directory itself. The -delete action also implies -depth.

-maxdepth levels

Descend at most levels (a non-negative integer) levels of directories below > the command line arguments. -maxdepth 0 means only apply the tests and actions to the command line arguments.

-mindepth levels

Do not apply any tests or actions at levels less than levels (a non-negative integer). -mindepth 1 means process all files except the command line arguments.

Upvotes: 1

Related Questions