Description of problem: find . -name *.<some extension> does not always work. How reproducible: Always Steps to Reproduce: 1. find . -name *.jpg 2. ls *.jpg 3. cd .. 4. find . -name *.jpg Actual Results: find erratically produces results, depending on what the current directory is. Expected Results: Should have returned the .jpg file listed in all instances. Additional info: [root@localhost bcling]# ls *.jpg 2001_07_03_094633_shot.jpg [root@localhost bcling]# find . -name *.jpg find: paths must precede expression Usage: find [path...] [expression] [root@localhost bcling]# pwd /home/bcling [root@localhost bcling]# find . -name *.jpg 2001_07_03_094633_shot.jpg <and lots of files in the /home/bcling/.netscape directory> Rawhide is also affected.
I can confirm that find acts buggy. The question is whether it is find or the file systtem. Both Gnome and KDE file directories seem to have trouble when files are moved keepin an acurate display.? That beeing said the errors returned by find make no sence and should be fixed. Here is a capture of find failing to work as advertized - the fix was to move to the root directory? This really ought to be fixed as it is a core comand to the CLI. [root@malaysia src]# find /usr -name samba* find: paths must precede expression Usage: find [path...] [expression] [root@malaysia src]# find /usr/ -name samba* find: paths must precede expression Usage: find [path...] [expression] [root@malaysia src]# cd / [root@malaysia /]# find /usr/ -name samba* /usr/lib/linuxconf/descriptions/eng/samba /usr/lib/linuxconf/descriptions/es/samba
The problem may actually be a syntax error. Using the command find . -name *.jpg causes the SHELL to match the *, not the find command. Therefore, in the submitter's example, while in the /home/bcling directory, the find command is evaluated by the shell to become: find . -name 2001_07_03_094633_shot.jpg This will only find the single file resident in the current directory, obviously. While in the / directory, the * evaluates to nothing if there are no actual "*.jpg" files in the / directory itself, thus the error (even if the error message itself is a little misdirecting). The proper way to use find would be in this fashion: find . -name "*.jpg" The double-quotes protect the * from being evaluated by the shell; rather the entire "*.jpg" argument is passed to the -name option of find, which is what is intended.
Yes, this is a quoting issue. Use: find -name '*.jpg' Closing.