1 You could try adding a * wildcard at the beginning. find -path *content/docs/file.xml worked for me. – BobMar 13 '12 at 8:58- thanks, @Bob, it's really worked for me. Btw, interesting, that if I'm adding a slash after an asterisk: "find -path */content/docs/file.xml", it doesn't work. Thanks a lot anyway.
– user69817Mar 13 '12 at 9:06 - also, @Bob, please make it as an answer and I'll mark it as a correct.
– user69817Mar 13 '12 at 9:08 - The reason the slash after asterisk didn't work is probably because the asterisk should have been escaped, see the edit to my answer.
– BobMar 13 '12 at 10:55
find . -path \*content/docs/file.xml
find . -path "*content/docs/file.xml"
$ find . -name *.c -print
find: paths must precede expression
This happens because *.c has been expanded by the shell resulting in find actually receiving a command line like this:
find . -name bigram.c code.c frcode.c locate.c -print
That command is of course not going to work. Instead of doing things this way, you should enclose the pattern in quotes or escape the wild‐ card:
$ find . -name \*.c -print
find /usr -wholename *in/abiw*>/usr/bin/abiword
- the flag is misleading, see my example... it just lets you extend the string into a directory if you know it
– technosaurusMar 13 '12 at 9:38
find . -type f | grep "content/docs/file.xml"
locate content/docs/file.xml
- locate is an interesting option, but it searches the whole disk, I'd like to have an ability to specify the base search directory or at least to specify using param, that search should be made from this directory (like your first option does), not from the root.
– user69817Mar 13 '12 at 8:56 1 @user69817 - on the contrary, locate doesn't search the disk, it interrogates a locate database, which typically gets populated via cron once a day.– tinkAug 9 at 21:12
dir=“/apps/*/instance01/"
arr=(`find ${dir} -name “*.jks"`)
arr=(`find ${dir} -name "*.keystore" -o -name "*.jks" -o -name "*.p12"`)
arr=(“/Users/ajay/Documents/keystore_and_p12files/"*.{keystore,p12,jks})