raison macrumors member Original poster 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 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 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.