renameFileOrDirectory method

Future<void> renameFileOrDirectory(
  1. String oldPath,
  2. String newPath
)

Implementation

Future<void> renameFileOrDirectory(String oldPath, String newPath) async {
  try {
    await fileOperations.renameFileOrDirectory(oldPath, newPath);
    pendingRenameFrom = null; // Clear the pending state on success
    sendResponse('250 Requested file action completed successfully');
  } catch (e) {
    pendingRenameFrom = null; // Clear the pending state on error
    sendResponse('550 Failed to rename: $e');
    logger.generalLog('Error renaming $oldPath to $newPath: $e');
  }
}