Find and special file names
Howdy y'all !!
Hope everyone is geared up for an awsome holz ! Am pulling my hair out on a problem with the find util while running a bash script in Cygwin. given the following 2 files in a directory named as such: nofoo.txt foo[bar].txt doing... find . -max-depth 1 -type f -name *.txt results only in the first file being found. I'm sure it has to do with the second file having brackets in it, and that fnmatch is wigging out on it.... how do I work around this? Thanks HUGE ! |
Aha !
Fingered it out m'self. {pat} {pat} :D
find . -maxdepth 1 -type f -regex .*.txt$ . . . Now..... could somone explain why the orginal metod fails? Is that the intended functionality? |
You need to add double quotes to the wildcard pattern, eg
find . -max-depth 1 -type f -name "*.txt" otherwise the asterisk gets expanded by the shell before the command executes. |
All times are GMT -5. The time now is 09:18 PM. |