This recipe will show you how you can list files and directories in MicroPython. We will also show the techniques that you can use to filter a listing so that it only includes files or only includes directories. Once you have the ability to interact with the filesystem in this way, you can use it in your own projects, where your code will accept a dynamic list of files on the board that doesn't need to be hardcoded in your program. In this way, the files might represent a set of configurable audio files that you want to play, or a collection of images that you will display on an attached screen.
Listing files
Getting ready
You will need access to the REPL on Circuit Playground Express to run the code presented in this...