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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With