1

I have quite a bit of folders (more than 200) and I need a list of particular ones that has ".feat" in the end (they also contain subfolders that I do not need in the list). I was wondering if there is a way to sort them out somehow (in all subfolders)

UPD sorry it's linux! I was using "find . -type d *.feat" but it's almost impossible to filter out part of them that contain .feat only without subfolders in them.

I guess I need to edit depth to 3 subfolders maximum. The tree looks like it is parental/CS/B1/1.feat/ 1/ and so on (generated by the soft)

2 Answers2

1

There is this question: How to find a directory on Linux? Not a perfect duplicate, because you also need to know how to use wildcards with -name. The command will be:

find . -type d -name '*.feat'

Note the quotes are important.

If you need to limit "depth to 3 subfolders maximum", use GNU find with its -maxdepth. If your find does not support -maxdepth then see how to limit POSIX find to specific depth.

Kamil Maciorowski
  • 69,815
  • 22
  • 136
  • 202
0

I guess you need something like :
ls *.feat

ls allows to get the list of files and directories in the current directory.
*.feat allows to restrict to files whose name ends with '.feat'.

If you wish to get only directories (i.e. not files), you can use the --directory option :
ls --directory *.feat

Example :

> mkdir test.feat test2.feat test test2 && ls --directory *.feat
test2.feat  test.feat
FloT
  • 377
  • 1
  • 2
  • 11
  • 1
    Thank you so much! It gives me the folders in parental directory only. The tree looks like parental/CS/B1/1.feat/ 1/ I was using "find . -type d *.feat" but it gives me subdirectories too – Vitto Titto Nov 11 '20 at 13:30
  • Then you can look at Kamil Maciorowski's answer, I think it fits what you need :) – FloT Nov 11 '20 at 13:53