@Override
    public void delete(final Map<Path, TransferStatus> files, final PasswordCallback prompt, final Callback callback) throws BackgroundException {
        for(Path file : files.keySet()) {
            try {
                callback.delete(file);
                // Delete the file or folder at a given path. If the path is a folder, all its contents will be deleted too.
                if(file.attributes().isDuplicate()) {
                    new DbxUserFilesRequests(session.getClient(file)).permanentlyDelete(containerService.getKey(file),
                            file.attributes().getVersionId());
                }
                else {
                    new DbxUserFilesRequests(session.getClient(file)).deleteV2(containerService.getKey(file));
                }
            }
            catch(DbxException e) {
                throw new DropboxExceptionMappingService().map("Cannot delete {0}", e, file);
            }
        }
    }
@Test
    public void testDeleteDirectory() throws Exception {
        final Path folder = new DropboxDirectoryFeature(session).mkdir(
                new Path(new DefaultHomeFinderService(session).find(), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.volume, Path.Type.directory)), new TransferStatus());
        final Path file = new DropboxTouchFeature(session).touch(
                new Path(folder, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus());
        new DropboxDeleteFeature(session).delete(Collections.singletonList(folder), new DisabledLoginCallback(), new Delete.DisabledCallback());
        assertFalse(new DropboxFindFeature(session).find(file));
    }