My goal is to match specific files from specific sub directories. I have the following folder structure
`-- data |-- a |-- a.txt |-- b |-- b.txt |-- c |-- c.txt |-- d |-- d.txt |-- e |-- e.txt |-- org-1 | |-- a.org | |-- b.org | |-- org.txt | |-- user-0 | | |-- a.txt | | |-- b.txt
I am trying to list the files only inside the data directory. I am able to get the correct result using the following command in RHEL
find ./testdir/ -iwholename "*/data/[!/].txt" a.txt b.txt c.txt d.txt e.txt
If I run the same command in Ubuntu it is not working.
Can anyone please tell me why it is not working in Ubuntu ?
After some tests I realized that as per my post it is working properly in both RHEL and Ubuntu. The problem lies somewhere else. The file which I have in my Ubuntu system are data files.
It is very strange that for these file types it is not listing both in RHEL and Ubuntu.
[supratik@testserver ~]$ ls testprog/data/ a.txt data.dat [supratik@testserver ~]$ file testprog/data/a.txt testprog/data/a.txt: ASCII text [supratik@testserver ~]$ file testprog/data/data.dat testprog/data/data.dat: data [supratik@testserver ~]$ find ./testprog/ -iwholename "*/data/[!/].txt" ./testprog/data/a.txt [supratik@testserver ~]$ find ./testprog/ -iwholename "*/data/[!/].dat"