@Override
    public void delete(final Map<Path, TransferStatus> files, final PasswordCallback prompt, final Callback callback) throws BackgroundException {
        for(Path file : files.keySet()) {
            if(file.isFile() || file.isSymbolicLink()) {
                callback.delete(file);
                try {
                    Files.delete(session.toPath(file));
                }
                catch(IOException e) {
                    throw new LocalExceptionMappingService().map("Cannot delete {0}", e, file);
                }
            }
        }
        for(Path file : files.keySet()) {
            if(file.isDirectory() && !file.isSymbolicLink()) {
                callback.delete(file);
                try {
                    Files.delete(session.toPath(file));
                }
                catch(IOException e) {
                    throw new LocalExceptionMappingService().map("Cannot delete {0}", e, file);
                }
            }
        }
    }
@Test
    public void testDeleteSymlink() throws Exception {
        final LocalSession session = new LocalSession(new Host(new LocalProtocol(), new LocalProtocol().getDefaultHostname()));
        session.open(new DisabledProxyFinder(), new DisabledHostKeyCallback(), new DisabledLoginCallback(), new DisabledCancelCallback());
        session.login(new DisabledLoginCallback(), new DisabledCancelCallback());
        final Path folder = new Path(new LocalHomeFinderFeature().find(), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory));
        new LocalDirectoryFeature(session).mkdir(folder, new TransferStatus());
        final Path file = new Path(folder, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
        new LocalTouchFeature(session).touch(file, new TransferStatus());
        final Path symlink = new Path(new LocalHomeFinderFeature().find(), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
        new LocalSymlinkFeature(session).symlink(symlink, folder.getAbsolute());
        new LocalDeleteFeature(session).delete(new ArrayList<>(Collections.singletonList(symlink)), new DisabledLoginCallback(), new Delete.DisabledCallback());
        assertFalse(Files.exists(session.toPath(symlink)));
        assertTrue(Files.exists(session.toPath(folder)));
    }