Find not searching subdirectories
I tried searching for files in documents:
joe@Debian:~/documents$ find -iname *.odt ./canadian-public-holidays.odt I then moved to the work_search directory which is located in documents: cd work_search joe@Debian:~/documents/work_search$ joe@Debian:~/documents/work_search$ find -iname *.odt Find finds more .odt files in the subdirectories. ./search/applications/sent/2009/7.13.bindery/2009.07.13.asap-print-depot-attach.odt ./search/applications/sent/2009/7.13.bindery/2009.07.13.all-canadian-printing-attach.odt ./search/applications/sent/2009/7.13.bindery/2009.07.13.signature-press-attach.odt ./search/applications/sent/2009/7.13.bindery/2009.07.13.octavia+co-press-attach.odt ./search/applications/sent/2009/7.13.bindery/2009.07.13.central-web-calgary-atttach.odt ./search/applications/sent/2009/7.13.bindery/2009.07.13.apache-superior-printing-attach.odt ./search/applications/sent/2009/7.13.bindery/2009.07.13.kallen-graphics-attach.odt ./search/applications/sent/2009/7.13.bindery/2009.07.13.copy-repro-inc-attach.odt ./search/applications/sent/2009/7.13.bindery/2009.07.13.mcAra-printing-attach.odt ./search/applications/sent/2009/7.13.bindery/2009.07.13.active-bindery-attach.odt ./search/applications/sent/2009/7.13.bindery/2009.07.13.bolder-graphics-attach.odt Why didn't find locate these files from the documents directory; I thought it was supposed to search all the subdirectories; when I changed into work_search it searched the subdirectories under it? what am I not understanding here? Thanks |
You need to prevent the shell from expanding the *:
Code:
find -iname '*.odt' |
Don't you also need to specify the search path (or maybe it defaults to current directory)?
for many reasons, I now ALWAYS do find thusly: assume the search term is "fred" find <path> -name "*fred*" (finds all files with a name containing "fred" anywhere. |
locate is excellent, and pre-installed on all the distros I've used. It's much faster than find
Code:
locate .odt Code:
locate .odt | grep Documents Code:
updatedb |
i think linux defaults to ., while bsd doesn't. best to always specify the path, as pixellany says.
|
Quote:
Quote:
Code:
locate .odt | grep -i Documents Code:
locate documents | grep -i .odt Code:
locate documents | grep -i canadian | grep -i .odt |
Thanks for help.
I forgot about quoting:'*.odt' I'll take a look at locate. |
All times are GMT -5. The time now is 06:23 AM. |