![JAR search and dependency download from the Maven repository](/logo.png)
fr.insee.eno.utils.FolderCleaner Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of eno-core Show documentation
Show all versions of eno-core Show documentation
Eno is a tool that generates survey questionnaires starting from their formal description in DDI
package fr.insee.eno.utils;
import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
/**
* Service used to clean folders (deletes all files)
*
* @author gerose
*
*/
public class FolderCleaner {
private final static Logger logger = LoggerFactory.getLogger(FolderCleaner.class);
/**
* Generic method to clean one folder
*
* @param folder : the folder to be cleaned
* @throws IOException : FileNotfound / NoAccess mainly
*/
public static void cleanOneFolder(File folder) throws IOException {
logger.debug("Cleaning " + folder);
if (folder.exists() && Files.isDirectory(folder.toPath())) {
FileUtils.cleanDirectory(folder);
}
Files.deleteIfExists(Paths.get(folder.toURI()));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy