10

I have this bash command:

FILES=$(find $(dirname "$DIR")/**/**/*.js -type f -maxdepth 8 -not -path "*/babel/*" -not -path "*/examples/*");

I get this warning:

find: warning: you have specified the -maxdepth option after a non-option argument -type, but options are not positional (-maxdepth affects tests specified before it as well as those specified after it). Please specify options before other arguments.

Anyone know what that's about? Google yield nothing. If there is anything else dubious about my command please lmk!

1
  • I don't think I am using the globs and maxdepth correctly, probably should use one or the other? Commented Dec 8, 2016 at 3:55

1 Answer 1

12

If you read the message it tells you that you have used -maxdepth after -type. The point is that -maxdepth is a global option (others include -xdev to avoid searches crossing mount points and -noleaf which stops find assuming that directories have standard unix link counts) and -type is part of an expression.

If you swap the order of -type f and -maxdepth 8 the message will go away.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .