Get list of all files - have I recursivly parse file managers result?

Hi,

short question: I like to loop over all files in Python but the file manager give me a recursive hierarchy of dictionaries. Is there a standard way to get simply a list of all GCODE files uploaded in a list? Did not find any...if not I will build a recursive function to get my list...

https://docs.octoprint.org/en/master/modules/filemanager.html#module-octoprint.filemanager.storage

Cheers,
Nils

You should know by now you can probably search my github user profile for these answers @Nils ...

Maybe one of these will help?

Hi.

Perhaps you run into the same issue I do. The Crawl Commands does not dive into the folder structure if I am right. The list_files function creates a hierarchy of dictionaries arranged with "children" as a link.

If I understand the examples right it will loop through the top folder only. I implemented it like this actually and run into an issue with my plugin that the content of folders is ignored. :slight_smile:

Created an recursive flattening function that will build a dictionary on the path.

Yeah, you basically re-created what I did with crawl_files...I just do the children/folder handling in the process_gcode function.