Ls = find

ls -ltr ??src/*.err is equivalent to what syntax in find
I only want to list *.err files in ??src DIRs
Thank you much for any help you can provide.
[/code]---------- Post updated at 08:55 AM ---------- Previous update was at 08:39 AM ----------

find . -type d -name '??src' seems to work for me, but it also shows beyond . directory.

Try:

find ??src \( ! -path '*/*' -o -prune \) -name '*.err' -exec ls -ltr {} +

or if you want to include deeper directories:

find ??src -name '*.err' -exec ls -ltr {} +

@Scrutinizer, all wildcards for find must be quoted, including -name "*.err" , otherwise the shell might substitute it by matches in the current directory.
--
For only listing the files I would use your ls command.
For doing more with each file I propose a for loop

for i in ??src/*.err
do
  if [ -f "$i" ]
  then
     echo "do something with file '$i'"
  fi
done
1 Like

Yes you are right, I know, don't know why I left it out. Corrected in my post

Many thanks to y'all!