List of all subfolders and theire subfolders etc.

201 Ansichten (letzte 30 Tage)
Drach
Drach am 7 Mär. 2019
Bearbeitet: M J am 22 Sep. 2020
Hello everybody,
I have a directory and I want to create a list that contains the paths of all subfolders within that directory and all subfolders within every subfolder in that list and so on.
I'm actually looking for specific folders that contain a number of specific files. The directory I'm working on has x amount of "layers" of subolders. I tried to use a recursive function to get those specific folders but I can't quite make it. So my second approach is just to get a huge list of every folder (including all subfolders, theire subfolders, and so on...) and its path within my main directory and then in a second step check everyone of those folders individually for these specific files.
Is there a way to get all those folders within a directory? I've got the feeling I'm missing an easy approach here.
Thanks alot in advance!

Akzeptierte Antwort

Fangjun Jiang
Fangjun Jiang am 7 Mär. 2019
Yes. list=dir('**/*.*') will do it. Then check for list.isdir
  4 Kommentare
Fangjun Jiang
Fangjun Jiang am 18 Sep. 2020
You probably could do some processing, such as counting the number of "/" in the path after getting all the subfolders.
M J
M J am 22 Sep. 2020
Bearbeitet: M J am 22 Sep. 2020
Found a way to do it, thank you very much!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Search Path finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by