@Override
    public void delete(final Map<Path, TransferStatus> files, final PasswordCallback prompt, final Callback callback) throws BackgroundException {
        for(Path f : files.keySet()) {
            if(f.isPlaceholder()) {
                log.warn(String.format("Ignore placeholder %s", f));
                continue;
            }
            callback.delete(f);
            try {
                if(new SimplePathPredicate(DriveHomeFinderService.SHARED_DRIVES_NAME).test(f.getParent())) {
                    session.getClient().teamdrives().delete(fileid.getFileId(f)).execute();
                }
                else {
                    if(f.attributes().isDuplicate()) {
                        if(log.isWarnEnabled()) {
                            log.warn(String.format("Delete file %s already in trash", f));
                        }
                        // Permanently deletes a file version
                        session.getClient().revisions().delete(fileid.getFileId(f), f.attributes().getVersionId()).execute();
                    }
                    else {
                        session.getClient().files().delete(fileid.getFileId(f))
                                .setSupportsAllDrives(new HostPreferences(session.getHost()).getBoolean("googledrive.teamdrive.enable")).execute();
                    }
                }
                fileid.cache(f, null);
            }
            catch(IOException e) {
                throw new DriveExceptionMappingService(fileid).map("Cannot delete {0}", e, f);
            }
        }
    }
@Test
    public void testDeleteMultipleFiles() throws Exception {
        final DriveFileIdProvider fileid = new DriveFileIdProvider(session);
        final Path folder = new DriveDirectoryFeature(session, fileid).mkdir(new Path(DriveHomeFinderService.MYDRIVE_FOLDER, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)), new TransferStatus());
        final Path file1 = new DriveTouchFeature(session, fileid).touch(new Path(folder, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus());
        final Path file2 = new DriveTouchFeature(session, fileid).touch(new Path(folder, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus());
        assertTrue(new DriveFindFeature(session, fileid).find(file1));
        assertTrue(new DriveFindFeature(session, fileid).find(file2));
        new DriveDeleteFeature(session, fileid).delete(Arrays.asList(file1, file2), new DisabledLoginCallback(), new Delete.DisabledCallback());
        assertFalse((new DriveFindFeature(session, fileid).find(file1, new DisabledListProgressListener())));
        assertFalse((new DriveFindFeature(session, fileid).find(file2, new DisabledListProgressListener())));
        assertTrue(new DriveFindFeature(session, fileid).find(folder, new DisabledListProgressListener()));
        new DriveDeleteFeature(session, fileid).delete(Collections.singletonList(folder), new DisabledLoginCallback(), new Delete.DisabledCallback());
        assertFalse((new DriveFindFeature(session, fileid).find(folder, new DisabledListProgressListener())));
    }