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:algorithm.AbstractAlgorithmTest.java

/**
 * Delete the test directory after each algorithm test. This prevents that
 * the resulting test files influence other algorithm tests.
 *///from w w w.  j a  v  a  2 s  .c o m
@After
public void deleteTestDirectory() {
    File testDir1 = new File(RESTORED_DIRECTORY);
    File testDir2 = new File(OUTPUT_DIRECTORY);
    try {
        FileUtils.deleteDirectory(testDir1);
        FileUtils.deleteDirectory(testDir2);
    } catch (IOException e) {
        System.err.println("Failt do delete test directories!");
        e.printStackTrace();
    }
}

From source file:com.github.neoio.nio.impl.FileChannelIOStagingFactory.java

@Override
public void close() throws IOException {
    FileUtils.deleteDirectory(baseStagingDir);
}

From source file:de.uzk.hki.da.at.ATUseCaseIngestLIDO.java

@After
public void tearDown() throws IOException {
    FileUtils.deleteDirectory(retrievalFolder);
}

From source file:de.uzk.hki.da.service.RetrievePackagesHelperTest.java

@After
public void tearDown() throws IOException {
    FileUtils.deleteDirectory(Path.make(workAreaRootPathPath, "work/TEST/id/loadedAIPs").toFile());
    FileUtils.deleteDirectory(Path.make(workAreaRootPathPath, "work/TEST/id/data").toFile());
}

From source file:com.github.pemapmodder.pocketminegui.utils.Utils.java

private static File installLinuxPHP(File home, InstallProgressReporter progress) {
    progress.report(0.0);//from  www.  ja v  a2  s  .  com
    File bin = new File(home, ".pmgui_tmp_pm_linux_installer");
    bin.mkdirs();
    try {
        InputStream get = new URL("http", "get.pocketmine.net", "").openStream();
        Process bash = new ProcessBuilder("bash -s - -v development").directory(bin)
                .redirectOutput(ProcessBuilder.Redirect.INHERIT).redirectError(ProcessBuilder.Redirect.INHERIT)
                .start();
        progress.report(0.25);
        byte[] bytes = IOUtils.toByteArray(get);
        progress.report(0.5);
        bash.getOutputStream().write(bytes);
        int result = bash.waitFor();
        progress.report(0.75);
        if (result == 0) {
            File out = new File(bin, "bin");
            FileUtils.copyDirectory(out, new File(home, "bin"));
            FileUtils.deleteDirectory(bin);
            File output = new File(out, "php7/bin/php");
            progress.completed(output);
            return output;
        } else {
            FileUtils.deleteDirectory(bin);
            return null;
        }
    } catch (IOException | InterruptedException e) {
        e.printStackTrace();
        try {
            FileUtils.deleteDirectory(bin);
        } catch (IOException e1) {
        }
        return null;
    }
}

From source file:com.cedarsoft.serialization.serializers.jackson.registry.FileBasedSerializedObjectsAccessTest.java

License:asdf

@After
public void tearDown() throws Exception {
    FileUtils.deleteDirectory(access.getBaseDir());
}

From source file:net.sourceforge.atunes.kernel.modules.repository.RemoveFoldersFromDiskBackgroundWorker.java

@Override
protected Void doInBackground() {
    for (IFolder folder : this.foldersToRemove) {
        try {/*w  w w  . j  a v a 2 s. c  o m*/
            FileUtils.deleteDirectory(folder.getFolderPath(this.osManager));
            Logger.info(StringUtils.getString("Removed folder ", folder));
        } catch (IOException e) {
            Logger.info(StringUtils.getString("Could not remove folder ", folder, e.getMessage()));
        }
    }
    return null;
}

From source file:io.fluo.core.ITBase.java

@BeforeClass
public static void setUpAccumulo() throws Exception {
    instanceName = System.getProperty(IT_INSTANCE_NAME_PROP, "it-instance-default");
    File instanceDir = new File("target/accumulo-maven-plugin/" + instanceName);
    boolean instanceClear = System.getProperty(IT_INSTANCE_CLEAR_PROP, "true").equalsIgnoreCase("true");
    if (instanceDir.exists() && instanceClear) {
        FileUtils.deleteDirectory(instanceDir);
    }//from  ww  w.  ja  v a  2  s .co  m
    if (!instanceDir.exists()) {
        MiniAccumuloConfig cfg = new MiniAccumuloConfig(instanceDir, PASSWORD);
        cfg.setInstanceName(instanceName);
        cluster = new MiniAccumuloCluster(cfg);
        cluster.start();
        startedCluster = true;
    }
    miniAccumulo = new MiniAccumuloInstance(instanceName, instanceDir);
    conn = miniAccumulo.getConnector(USER, new PasswordToken(PASSWORD));
}

From source file:com.linkedin.pinot.integration.tests.LLCRealtimeClusterIntegrationTest.java

@BeforeClass
@Override/*from  w  w  w.  java2  s .c  om*/
public void setUp() throws Exception {
    // TODO Avoid printing to stdout. Instead, we need to add the seed to every assert in this (and super-classes)
    System.out.println("========== Using random seed value " + RANDOM_SEED);
    // Remove the consumer directory
    File consumerDirectory = new File(CONSUMER_DIRECTORY);
    if (consumerDirectory.exists()) {
        FileUtils.deleteDirectory(consumerDirectory);
    }

    super.setUp();
}

From source file:com.tasktop.c2c.server.configuration.service.tests.TemplateProcessingConfiguratorTest.java

@After
public void removeTargetDir() throws Exception {
    FileUtils.deleteDirectory(targetDir);
}