MCPcopy Create free account
hub / github.com/BruceDevices/firmware / renameFile

Function renameFile

src/core/sd_functions.cpp:166–177  ·  view source on GitHub ↗

** Function name: renameFile ** Description: rename file or folder ***************************************************************************************/

Source from the content-addressed store, hash-verified

164** Description: rename file or folder
165***************************************************************************************/
166bool renameFile(FS fs, String path, String filename) {
167 String newName = keyboard(filename, 76, "Type the new Name:");
168 if (newName == "\x1B") return false;
169 // Rename the file of folder
170 if (fs.rename(path, path.substring(0, path.lastIndexOf('/')) + "/" + newName)) {
171 // Serial.println("Renamed from " + filename + " to " + newName);
172 return true;
173 } else {
174 // Serial.println("Fail on rename.");
175 return false;
176 }
177}
178/***************************************************************************************
179** Function name: copyToFs
180** Description: copy file from SD or LittleFS to LittleFS or SD

Callers 1

loopSDFunction · 0.85

Calls 1

keyboardFunction · 0.70

Tested by

no test coverage detected