handleMdtm method

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

Implementation

void handleMdtm(String argument, FtpSession session) {
  try {
    if (!session.fileOperations.exists(argument)) {
      session.sendResponse('550 File not found');
      return;
    }

    String fullPath = session.fileOperations.resolvePath(argument);
    File file = File(fullPath);
    if (file.existsSync()) {
      var stat = file.statSync();
      String modificationTime = _formatMdtmTimestamp(stat.modified);
      session.sendResponse('213 $modificationTime');
    } else {
      session.sendResponse('550 File not found');
    }
  } catch (e) {
    session.sendResponse('550 Could not get modification time: $e');
    logger.generalLog('Error getting modification time: $e');
  }
}