0

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.

dotancohen
  • 15,864

2 Answers2

1

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
John
  • 17,011
  • 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
dotancohen
  • 15,864