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:net.sf.zekr.common.runtime.ApplicationRuntime.java

/**
 * Recreates cache for Quran, translation.
 * /*from   w w  w.  jav  a2 s  .co  m*/
 * @throws IOException
 */
public void recreateHtmlCache() throws IOException {
    logger.info("Recreate HTML cache directory.");

    File cache = new File(Naming.getViewCacheDir());
    if (cache.exists())
        FileUtils.deleteDirectory(cache);
    cache.mkdir();
    new File(Naming.getQuranCacheDir()).mkdir();
    new File(Naming.getTransCacheDir()).mkdir();
    new File(Naming.getMixedCacheDir()).mkdir();
    new File(Naming.getSearchCacheDir()).mkdir();
}

From source file:gobblin.data.management.conversion.hive.LocalHiveMetastoreTestUtils.java

private LocalHiveMetastoreTestUtils() throws IOException {
    try {/*from w  ww .jav a 2 s .  c om*/
        FileUtils.deleteDirectory(new File("metastore_db"));
    } catch (IOException e) {
        e.printStackTrace();
    }
    this.localMetastoreClient = HiveMetastoreClientPool.get(new Properties(), Optional.<String>absent())
            .getClient().get();
}

From source file:com.willwinder.universalgcodesender.model.GUIBackendPreprocessorTest.java

@After
public void teardown() throws IOException {
    FileUtils.deleteDirectory(tempDir.toFile());
}

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

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

From source file:com.redhat.red.offliner.PlaintextArtifactListReaderTest.java

@AfterClass
public static void cleanup() throws IOException {
    File tempDir = new File(TEMP_DIR);
    if (tempDir.exists()) {
        FileUtils.deleteDirectory(tempDir);
    }/* www  . j a  va2 s .c om*/
}

From source file:co.cask.cdap.filetailer.tailer.TailerLogUtils.java

public static void deleteTestDir() throws IOException {
    PipeConfiguration flowConf = loadConfig();
    File dir = flowConf.getSourceConfiguration().getWorkDir();
    FileUtils.deleteDirectory(dir);
}

From source file:com.tasktop.c2c.server.scm.service.ScmServiceBeanTest.java

@Before
public void setup() throws IOException {
    File gitRootFile = new File(gitRoot);
    if (!gitRootFile.exists()) {
        gitRootFile.mkdirs();//w ww.ja v  a2s .  co  m
    } else {
        FileUtils.deleteDirectory(gitRootFile);
    }

    TenancyContextHolder.createEmptyContext();
    TenancyUtil.setProjectTenancyContext(projId);
}

From source file:git.egatuts.android.FileUtils.EgaFileSystem.java

/**
 * (non-Javadoc)//from   w  w  w  . j ava 2  s. c om
 * @see git.egatuts.android.FileUtils.EgaFileSystemBase#deleteFile(java.io.File)
 */
@Override
public void deleteFile(File file) throws IOException {
    File deletedName = new File(file.getAbsolutePath() + System.currentTimeMillis());
    file.renameTo(deletedName);
    if (!file.isFile()) {
        file.delete();
        return;
    }
    FileUtils.deleteDirectory(file);
}

From source file:com.twitter.distributedlog.LocalDLMEmulator.java

public static void main(String[] args) throws Exception {
    try {/* w  w  w.  ja  va 2 s. c  om*/
        if (args.length < 1) {
            System.out.println("Usage: LocalDLEmulator <zk_port>");
            System.exit(-1);
        }

        final int zkPort = Integer.parseInt(args[0]);
        final File zkDir = IOUtils.createTempDir("distrlog", "zookeeper");
        final LocalDLMEmulator localDlm = LocalDLMEmulator.newBuilder().zkPort(zkPort).build();

        Runtime.getRuntime().addShutdownHook(new Thread() {
            @Override
            public void run() {
                try {
                    localDlm.teardown();
                    FileUtils.deleteDirectory(zkDir);
                    System.out.println("ByeBye!");
                } catch (Exception e) {
                    // do nothing
                }
            }
        });
        localDlm.start();

        System.out.println(
                String.format("DistributedLog Sandbox is running now. You could access distributedlog://%s:%s",
                        DEFAULT_ZK_HOST, zkPort));
    } catch (Exception ex) {
        System.out.println("Exception occurred running emulator " + ex);
    }
}

From source file:edu.monash.merc.util.file.DMFileUtils.java

public static void deleteDirectory(String dirName) {
    if (dirName == null) {
        throw new DMFileException("directory name must not be null");
    }//from w w w . j a  va 2  s .  c om

    try {
        FileUtils.deleteDirectory(new File(dirName));
    } catch (Exception e) {
        throw new DMFileException(e);
    }
}