** Function name: renameFile ** Description: rename file or folder ***************************************************************************************/
| 164 | ** Description: rename file or folder |
| 165 | ***************************************************************************************/ |
| 166 | bool 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 |