"RMD", null));
return;
}
// get file object
FtpFile file = null;
try {
file = session.getFileSystemView().getFile(fileName);
} catch (Exception ex) {
LOG.debug("Exception getting file object", ex);
}
if (file == null) {
session.write(LocalizedFtpReply.translate(session, request, context,
FtpReply.REPLY_550_REQUESTED_ACTION_NOT_TAKEN,
"RMD.permission", fileName));
return;
}
// check permission
fileName = file.getAbsolutePath();
if (!file.isRemovable()) {
session.write(LocalizedFtpReply.translate(session, request, context,
FtpReply.REPLY_550_REQUESTED_ACTION_NOT_TAKEN,
"RMD.permission", fileName));
return;
}
// check file
if (!file.isDirectory()) {
session.write(LocalizedFtpReply.translate(session, request, context,
FtpReply.REPLY_550_REQUESTED_ACTION_NOT_TAKEN,
"RMD.invalid", fileName));
return;
}
// now delete directory
if (file.delete()) {
session.write(LocalizedFtpReply.translate(session, request, context,
FtpReply.REPLY_250_REQUESTED_FILE_ACTION_OKAY, "RMD",
fileName));
// write log message