handleRnfr method

void handleRnfr(
  1. String argument,
  2. FtpSession session
)

Implementation

void handleRnfr(String argument, FtpSession session) {
  if (session.serverType == ServerType.readOnly) {
    session.sendResponse('550 Command not allowed in read-only mode');
    return;
  }

  if (argument.isEmpty) {
    session.sendResponse('501 Syntax error in parameters or arguments');
    return;
  }

  // Check if the file/directory exists
  if (!session.fileOperations.exists(argument)) {
    session.sendResponse('550 File not found');
    return;
  }

  // Store the source path for the rename operation
  session.pendingRenameFrom = argument;
  session
      .sendResponse('350 Requested file action pending further information');
}