/** * Checks whether there are any files anywhere in the directory tree rooted * at dir (directories don't count as files). dir must exist * @return true if there are no files * @throws IOException if unable to list subdirectories */ public static boolean dirNoFilesRecursive( FsVolumeSpi volume, File dir, FileIoProvider fileIoProvider) throws IOException { File[] contents = fileIoProvider.listFiles(volume, dir); if (contents == null) { throw new IOException("Cannot list contents of " + dir); } for (File f : contents) { if (!f.isDirectory() || (f.isDirectory() && !dirNoFilesRecursive( volume, f, fileIoProvider))) { return false; } } return true; }
File[] files = fileIoProvider.listFiles(volume, source); int numRecovered = 0; for (File file : files) {
for (File f : fileIoProvider.listFiles(this, bpCurrentDir)) { if (!fileIoProvider.delete(this, f)) { throw new IOException("Failed to delete " + f); throw new IOException("Failed to delete " + bpCurrentDir); for (File f : fileIoProvider.listFiles(this, bpDir)) { if (!fileIoProvider.delete(this, f)) { throw new IOException("Failed to delete " + f);
List<IOException> exceptions, Queue<RecursiveAction> subTaskQueue) throws IOException { File[] files = fileIoProvider.listFiles(volume, dir); Arrays.sort(files, FILE_COMPARATOR); for (int i = 0; i < files.length; i++) {