File-exclusion based on an array of prefixes
you can use java.io.FilenameFilter like:

    final List&lt;String&gt; excludedFiles = Arrays.asList(filesToBeExcluded);
    File[] totalFiles = sourceDirectory.listFiles(new FilenameFilter() {
        @Override
        public boolean accept(File dir, String name) {
            return !excludedFiles.contains(name);
        }
    });