Example usage for org.apache.commons.io FileUtils deleteDirectory

List of usage examples for org.apache.commons.io FileUtils deleteDirectory

Introduction

In this page you can find the example usage for org.apache.commons.io FileUtils deleteDirectory.

Prototype

public static void deleteDirectory(File directory) throws IOException 

Source Link

Document

Deletes a directory recursively.

Usage

From source file:cascading.HiveTestCase.java

@BeforeClass
public static void beforeClass() throws IOException {
    // do this once per class, otherwise we run into bizarre derby errors
    if (DERBY_HOME.exists())
        FileUtils.deleteDirectory(DERBY_HOME);
    DERBY_HOME.mkdirs();//from   w w w.  j  a v a2  s.c  om
    System.setProperty("derby.system.home", DERBY_HOME.getAbsolutePath());
    System.setProperty(HiveConf.ConfVars.METASTOREWAREHOUSE.varname, HIVE_WAREHOUSE_DIR);
}

From source file:edu.osu.netmotifs.warswap.common.CreateDirectory.java

public static boolean deleteDir(String directoryPath) {
    boolean success = true;
    // Delete directory in Java, if it doesn't exists
    File directory = new File(directoryPath);
    if (!directory.exists()) {
        logger.debug("Directory does not exists! " + directoryPath);
    } else {/*from  w  w w  .ja v  a 2 s  .co  m*/
        success = directory.delete();
        try {
            FileUtils.deleteDirectory(directory);
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (success) {
            logger.debug("Directory successfully deleted : " + directoryPath);
        } else {
            logger.error("Failed to delete directory: " + directoryPath);
        }
    }
    return success;
}

From source file:com.linkedin.pinot.core.segment.index.loader.LoaderUtilsTest.java

@BeforeClass
public void setUp() throws IOException {
    FileUtils.deleteDirectory(TEST_DIR);
    Assert.assertTrue(TEST_DIR.mkdirs());
}

From source file:com.tinspx.util.io.callbacks.FileTests.java

public static Closeable teardownTestDir(@NonNull final File testDir) throws IOException {
    return new Closeable() {
        @Override//from  w w  w.j  a  va2s  .c om
        public void close() throws IOException {
            FileUtils.deleteDirectory(testDir);
        }
    };
}

From source file:net.dontdrinkandroot.lastfm.api.cache.DiskCacheTest.java

@After
public void after() throws IOException {

    FileUtils.deleteDirectory(this.baseDir);
}

From source file:de.oppermann.pomutils.MainCallTest.java

@Override
protected void setUp() throws Exception {
    super.setUp();

    File targetDirectory = new File("target/testresources/mainCall");
    FileUtils.deleteDirectory(targetDirectory);
    FileUtils.copyDirectory(new File("src/test/resources/mainCall"), targetDirectory);
}

From source file:net.fabricmc.installer.installer.ClientInstaller.java

public static void install(File mcDir, String version, IInstallerProgress progress) throws IOException {
    String[] split = version.split("-");
    if (isValidInstallLocation(mcDir, split[0]).isPresent()) {
        throw new RuntimeException(isValidInstallLocation(mcDir, split[0]).get());
    }// ww w  .ja  va  2 s .c o  m
    File fabricData = new File(mcDir, "fabricData");
    File fabricJar = new File(fabricData, version + ".jar");
    if (!fabricJar.exists()) {
        progress.updateProgress(Translator.getString("install.client.downloadFabric"), 10);
        FileUtils.copyURLToFile(new URL(MavenHandler.getPath(Reference.MAVEN_SERVER_URL,
                Reference.PACKAGE_FABRIC, Reference.NAME_FABRIC_LOADER, version)), fabricJar);
    }
    JarFile jarFile = new JarFile(fabricJar);
    Attributes attributes = jarFile.getManifest().getMainAttributes();
    String mcVersion = attributes.getValue("MinecraftVersion");
    install(mcDir, mcVersion, progress, fabricJar);
    FileUtils.deleteDirectory(fabricData);
}

From source file:com.flicklib.service.cache.HttpEHCacheTest.java

@After
public void cleanup() throws IOException {
    FileUtils.deleteDirectory(getCacheDir());
}

From source file:eu.sisob.uma.restserver.FileSystemManager.java

/**
 *
 * @param path//from  w w w.  ja v a  2  s  . co  m
 * @return
 * @throws IOException
 */
public static File createFileAndIfExistsDelete(String path) throws IOException {

    File dir = new File(path);
    if (!dir.exists())
        dir.mkdir();
    else {
        FileUtils.deleteDirectory(dir);
        dir.mkdir();
    }

    return dir;
}

From source file:ch.zhaw.iamp.rct.AppTest.java

public static void deleteTestConfigDirectory() throws IOException {
    File directory = new File(TEST_CONFIG_DIRECTORY);
    FileUtils.deleteDirectory(directory);
}