removeDirectory method

void removeDirectory(
  1. String dirname
)

Implementation

void removeDirectory(String dirname) async {
  String dirPath = _getFullPath(dirname);
  if (!_isPathAllowed(dirPath)) {
    sendResponse('550 Access denied');
    return;
  }

  var dir = Directory(dirPath);
  if (await dir.exists()) {
    await dir.delete();
    sendResponse('250 Directory deleted');
  } else {
    sendResponse('550 Directory not found');
  }
}