4

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!

  • I don't think I am using the globs and maxdepth correctly, probably should use one or the other? – Alexander Mills Dec 8 '16 at 3:55
4

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.