Ubuntu: find: unknown predicate



Question:

This is probably not a Ubuntu question as such, but a Linux one instead, still hope some Linux user out there can help me understand this.

I'm trying to use the find command to look for some files an a directory tree.

Unfortunately some of the files are named beginning with a dash, like -000.jpg, -002.jpg, 00n.jpg and so on. However, every time that the command locates one of the files named that way, it just interrupts the process and complains in the following way:

find: unknown predicate `-001.jpg'  

or whatever the file beginning with a dash is named.

It seems to me that somehow the find command is interpreting the resulting filename as an argument, but I haven't found a way to circumvent this behavior.

Thanks in advance for sharing your wisdom.


Solution:1

Make sure you quote the patterns you provide to find, otherwise the shell may expand them if there are matching files in the current dir.

find /some/dir -name *.jpg   # bad  find /some/dir -name "*.jpg" # good  

See http://mywiki.wooledge.org/UsingFind.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »