0

This question already has an answer here:

Consider:

$ find . -name *.css
./style.css
./view/css/style.css

$ ls view/css/
consultation.css  jquery.scombobox.min.css  page-content.css  style.css

Why might find have missed the files in view/css? This is on Ubuntu 15.10, an obscure Debian derivative.

marked as duplicate by don_crissti, dotancohen, Anthon, MelBurslan, Archemar Mar 22 '16 at 18:41

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2

I'm willing to be the problem has something to do with the shell interpreting your name expression as a glob. Try doing this:

$ find . -name \*.css
  • Yeah - however you want to protect the asterisk from being interpreted as a shell glob. – John Mar 22 '16 at 18:10
1

Right at the bottom of the find manpage is the following gem:

NON-BUGS
   $ find . -name *.c -print
   find: paths must precede expression
   Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]

   This  happens  because *.c has been expanded by the shell resulting in find actually receiving a
   command line like this:

So *.css was apparently expanded by Bash to style.css becasue that file exists in the current directory. Always escape * asterisks in find!

$ find . -name \*.css
./style.css
./view/css/consultation.css
./view/css/lib/jquery.mCustomScrollbar.css
./view/css/lib/normalize.min.css
./view/css/lib/swiper.min.css
./view/css/style.css
./view/css/jquery.scombobox.min.css
./view/css/page-content.css

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