I want to recursively search for all files and sub-directories within a directory with sub string within file name as 'string.txt'
My command:
cd /home/abcd/dir
grep -R "*rate-trace.txt" | wc -l
I want to recursively search for all files and sub-directories within a directory with sub string within file name as 'string.txt'
My command:
cd /home/abcd/dir
grep -R "*rate-trace.txt" | wc -l
grep
is searching the file's content.
Use find
command instead:
find /home/abcd/dir -type f -name "*rate-trace.txt" | wc -l
OR
cd /home/abcd/dir
find . -type f -name "*rate-trace.txt" | wc -l