raison macrumors member Original poster Nov 13, 2009 83 4 Aug 6, 2011 #1 I am trying to use the find tool to look for files that contains the question mark in their names. I am using: Code: find . -name *\?* -print But that is displaying all the files in the current directory. What is the proper way?
I am trying to use the find tool to look for files that contains the question mark in their names. I am using: Code: find . -name *\?* -print But that is displaying all the files in the current directory. What is the proper way?
fat jez macrumors 68020 Jun 24, 2010 2,086 618 Glasgow, UK Aug 6, 2011 #2 the . in between your find command and -name means current working directory, which is why it's only looking there, i.e. . current working directory .. parent directory
the . in between your find command and -name means current working directory, which is why it's only looking there, i.e. . current working directory .. parent directory
mfram Contributor Jan 23, 2010 1,390 450 San Diego, CA USA Aug 7, 2011 #3 You need to put single quotes around the filename part: Code: imac:~> find . -name '*\?*' ./bin/foo? imac:~> find . -name *\?* find: No match. The reason is because without the single quotes the shell will expand your *\?* in place which is not what you want.
You need to put single quotes around the filename part: Code: imac:~> find . -name '*\?*' ./bin/foo? imac:~> find . -name *\?* find: No match. The reason is because without the single quotes the shell will expand your *\?* in place which is not what you want.