@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);
            final SMBSession.DiskShareWrapper share = session.openShare(file);
            try {
                if(file.isFile() || file.isSymbolicLink()) {
                    share.get().rm(new SMBPathContainerService(session).getKey(file));
                }
                else if(file.isDirectory()) {
                    share.get().rmdir(new SMBPathContainerService(session).getKey(file), true);
                }
            }
            catch(SMBRuntimeException e) {
                throw new SMBExceptionMappingService().map("Cannot delete {0}", e, file);
            }
            finally {
                session.releaseShare(share);
            }
        }
    }
@Test
    public void testDeleteFileAndFolder() throws Exception {
        final Path home = new DefaultHomeFinderService(session).find();
        final Path folder = new SMBDirectoryFeature(session).mkdir(
                new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)), new TransferStatus());
        final Path file = new SMBTouchFeature(session).touch(
                new Path(home, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus());
        assertTrue(new SMBFindFeature(session).find(file));
        new SMBDeleteFeature(session).delete(Arrays.asList(file, folder), new DisabledPasswordCallback(), new Delete.DisabledCallback());
        assertFalse(new SMBFindFeature(session).find(file));
    }