What I want to do is searching for all files that end with .txt in the subdirectories, for example, I am in directory called user, which holds only the directories Test1 and Test2. Test1 contains t1.txt and another subdirectory Test3. Test2 contains t2.txt. Test3 contains t3.txt
I try to use find and egrep
find */ -name "*.txt" | egrep "*/[^/]*(.txt)$"
but it gives me
Test1/Test3/t3.txt
Test1/t1.txt
Test2/t2.txt
I want to print something like
Test1/t1.txt
Test2/t2.txt
Since I just want files end with .txt in subdirectories (not subdirectories of subdirectories) What am I supposed to do in order to get the result I want? Thanks in advance
I believe you want
find -mindepth 2 -maxdepth 2 -name "*.txt"