How to implement MakeSureDirectoryPathExists() in esp-idf?
Posted: Tue Jul 11, 2023 4:05 am
Hello there!
I just started a serious hobby project with ESP32 using esp-idf. This project uses SD Card for storing various data points that are organized in nested directories, and I would like to write a method similar to MakeSureDirectoryPathExists(). Basically I am looking for a function that will create all non-existing sub-directories in a directory path.
Let us say my SD Card is mounted as /sdcard, and I already have a directory in it viz., "/sdcard/data", so if I call this method with "/sdcard/data/devices/sensor1/data.csv", it should create sub-folders "devices" and "sensor1" (under respective parent directories of course). How can I do that in esp-idf? Since mine is a new project I am free to use any available library or filesystem that can make it easier to implement this function.
Thanks in advance!
I just started a serious hobby project with ESP32 using esp-idf. This project uses SD Card for storing various data points that are organized in nested directories, and I would like to write a method similar to MakeSureDirectoryPathExists(). Basically I am looking for a function that will create all non-existing sub-directories in a directory path.
Let us say my SD Card is mounted as /sdcard, and I already have a directory in it viz., "/sdcard/data", so if I call this method with "/sdcard/data/devices/sensor1/data.csv", it should create sub-folders "devices" and "sensor1" (under respective parent directories of course). How can I do that in esp-idf? Since mine is a new project I am free to use any available library or filesystem that can make it easier to implement this function.
Thanks in advance!