MCPcopy Create free account
hub / github.com/SmingHub/Sming / ls

Function ls

samples/SDCard/app/application.cpp:120–143  ·  view source on GitHub ↗

* @param path Start node to be scanned (also used as work area) */

Source from the content-addressed store, hash-verified

118 * @param path Start node to be scanned (also used as work area)
119 */
120FRESULT ls(const char* path)
121{
122 Serial.println(_F("Size\tName\t\tDate\t\tAttributes"));
123
124 DIR dir;
125 FRESULT res = f_opendir(&dir, path); /* Open the directory */
126 if(res == FR_OK) {
127 for(;;) {
128 FILINFO fno;
129 res = f_readdir(&dir, &fno); /* Read a directory item */
130 if(res != FR_OK || fno.fname[0] == 0) {
131 break; /* Break on error or end of dir */
132 }
133 if(fno.fname[0] == '.') {
134 continue; /* Ignore dot entry */
135 }
136
137 stat_file(fno.fname);
138 }
139 f_closedir(&dir);
140 }
141
142 return res;
143}
144
145void listFiles()
146{

Callers 1

listFilesFunction · 0.85

Calls 5

f_opendirFunction · 0.85
f_readdirFunction · 0.85
stat_fileFunction · 0.85
f_closedirFunction · 0.85
printlnMethod · 0.80

Tested by

no test coverage detected