All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bimserver.test.RemoveEmpty Maven / Gradle / Ivy

There is a newer version: 1.5.91
Show newest version
package org.bimserver.test;

import java.io.IOException;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

public class RemoveEmpty {
	public static void main(String[] args) {
		new RemoveEmpty().start(args[0]);
	}

	private void start(String loc) {
		Path base = Paths.get(loc);
		try {
			DirectoryStream newDirectoryStream = Files.newDirectoryStream(base);
			for (Path p : newDirectoryStream) {
				DirectoryStream a = Files.newDirectoryStream(p);
				int c = 0;
				for (Path b : a) {
					c++;
				}
				if (c == 1) {
					org.apache.commons.io.FileUtils.deleteDirectory(p.toFile());
				}
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy