I'm trying to create an array variable with a list of files to use in a small script, needing the full path to the file. Looking around I tried something like this:find /path/ -t f | grep randomStringIt turned out that this was returning only some of the files I needed, so I tried using wc -l with the previous command and with ls -R /path/ | grep randomString, getting different line counts (with a difference of more than 100 lines, so I'm counting the directories from ls -R out). I'm trying to see why find is not returning the desired results. Any ideas?
find and list -R returning different number of files
grep;find;ls
find lists all the files in the directory tree. ls -R actually lists fewer files: it omits dot files  you need ls -AR to include them.If you aren't finding the files you need, there are a few possibilities:You missed them in the output. Use a search command (e.g. find  | less and use the / key in less). Keep in mind that the output of find is not sorted.The files aren't actually called what you think they're called. Do a case-insensitive search if you aren't sure about the case.The files you're looking for are actually symbolic links. Use find -xtype f instead of find -type f to categorize symbolic links as the file they point to.The files are under a symbolic link to a directory. Use find -L to traverse symbolic links, but be careful: this could search a very large number of files if you have a symbolic link to a directory that's at the top of a large hierarchy.In no case would ls -R find files that find doesn't.You can't easily compare the number of lines in output of ls -R and find:ls -R omits dot files, find doesn't.ls -R has a total of three extra lines for each subdirectory (except for the root), compared with find -type f: the directory entry, the blank line that separates the listing of that directory from the previous line, and the header line with the directory name followed by a colon.