@Override
    public void delete(final Map<Path, TransferStatus> files, final PasswordCallback prompt, final Callback callback) throws BackgroundException {
        for(Path file : files.keySet()) {
            callback.delete(file);
            try {
                if(file.isFile() || file.isSymbolicLink()) {
                    if(!session.getClient().deleteFile(file.getAbsolute())) {
                        throw new FTPException(session.getClient().getReplyCode(), session.getClient().getReplyString());
                    }
                }
                else if(file.isDirectory()) {
                    // Change working directory to parent
                    if(!session.getClient().changeWorkingDirectory(file.getParent().getAbsolute())) {
                        throw new FTPException(session.getClient().getReplyCode(), session.getClient().getReplyString());
                    }
                    if(!session.getClient().removeDirectory(file.getAbsolute())) {
                        throw new FTPException(session.getClient().getReplyCode(), session.getClient().getReplyString());
                    }
                }
            }
            catch(IOException e) {
                throw new FTPExceptionMappingService().map("Cannot delete {0}", e, file);

            }
        }
    }
@Test
    public void testDeleteDirectory() throws Exception {
        final Path test = new Path(new FTPWorkdirService(session).find(), UUID.randomUUID().toString(), EnumSet.of(Path.Type.directory));
        new FTPDirectoryFeature(session).mkdir(test, new TransferStatus());
        new FTPDeleteFeature(session).delete(Collections.singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback());
    }