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

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

Introduction

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

Prototype

public static void cleanDirectory(File directory) throws IOException 

Source Link

Document

Cleans a directory without deleting it.

Usage

From source file:abs.backend.erlang.ErlApp.java

public ErlApp(File destDir) throws IOException {
    super();/*w  w  w.j  a v  a2  s .c  o  m*/
    this.destDir = destDir;
    this.destCodeDir = new File(destDir, "src/");
    this.destIncludeDir = new File(destDir, "include/");
    destDir.mkdirs();
    FileUtils.cleanDirectory(destDir);
    destDir.mkdirs();
    new File(destDir, "ebin").mkdir();
    copyRuntime();
}

From source file:c3.ops.priam.utils.SystemUtils.java

/**
 * delete all the files/dirs in the given Directory but dont delete the dir
 * itself./* ww  w.j a  va2s . c  o  m*/
 */
public static void cleanupDir(String dirPath, List<String> childdirs) throws IOException {
    if (childdirs == null || childdirs.size() == 0)
        FileUtils.cleanDirectory(new File(dirPath));
    else {
        for (String cdir : childdirs)
            FileUtils.cleanDirectory(new File(dirPath + "/" + cdir));
    }
}

From source file:com.indeed.lsmtree.recordlog.TestRecordLogDirectoryQuickly.java

@Override
public void tearDown() throws Exception {
    FileUtils.cleanDirectory(dir);
    FileUtils.deleteDirectory(dir);
}

From source file:net.mindengine.blogix.tests.acceptance.CompilerAccTest.java

@BeforeClass
public void beforeClass() throws IOException {
    if (compilerOutputDir.exists()) {
        FileUtils.cleanDirectory(compilerOutputDir);
    } else {//from w w w. j  av  a2 s.  c o  m
        FileUtils.forceMkdir(compilerOutputDir);
    }
}

From source file:com.buddycloud.mediaserver.download.DownloadImageTest.java

public void testTearDown() throws Exception {
    FileUtils.cleanDirectory(
            new File(configuration.getProperty(MediaServerConfiguration.MEDIA_STORAGE_ROOT_PROPERTY)
                    + File.separator + BASE_CHANNEL));

    dataSource.deleteMedia(MEDIA_ID);/*from ww  w .j a  v  a2s  . c o m*/
}

From source file:com.buddycloud.mediaserver.download.DownloadAvatarTest.java

public void testTearDown() throws Exception {
    FileUtils.cleanDirectory(
            new File(configuration.getProperty(MediaServerConfiguration.MEDIA_STORAGE_ROOT_PROPERTY)
                    + File.separator + BASE_CHANNEL));

    dataSource.deleteEntityAvatar(BASE_CHANNEL);
    dataSource.deleteMedia(MEDIA_ID);//  ww w.j  a  v  a  2 s .c om
}

From source file:com.buddycloud.mediaserver.upload.UploadAvatarTest.java

public void testTearDown() throws Exception {
    FileUtils.cleanDirectory(
            new File(configuration.getProperty(MediaServerConfiguration.MEDIA_STORAGE_ROOT_PROPERTY)
                    + File.separator + BASE_CHANNEL));
}

From source file:de.ist.clonto.triplestore.CLModelToJena.java

public void createTripleStore(Type rootType) throws FileNotFoundException {
    String directory = "./cleanedOntology2";
    try {//  w  ww. ja  va2 s.  com
        FileUtils.cleanDirectory(new File(directory));
    } catch (IOException ex) {
        Logger.getLogger(CLModelToJena.class.getName()).log(Level.SEVERE, null, ex);
    }

    Dataset dataset = TDBFactory.createDataset(directory);

    dataset.begin(ReadWrite.WRITE);
    model = dataset.getDefaultModel();
    typeResMap = new HashMap<>();
    entityResMap = new HashMap<>();

    Resource rootResource = model.getResource(tURI + typeResMap.size());
    typeResMap.put(rootType.getURIName(), rootResource);
    rootResource.addProperty(model.getProperty(URI + "name"), rootType.getName());
    rootResource.addProperty(model.getProperty(URI + "depth"), Integer.toString(rootType.getMinDepth()));

    transformType(rootType);

    // put outputstream instead of null
    dataset.commit();
    dataset.end();
}

From source file:net.mindengine.blogix.tests.acceptance.ExporterAccTest.java

@BeforeClass
public void init() throws IOException {
    destinationDir = new File("target" + File.separator + "exported-routes");
    if (destinationDir.exists()) {
        FileUtils.cleanDirectory(destinationDir);
    } else {/* ww w  .j av  a 2 s  .c  o m*/
        FileUtils.forceMkdir(destinationDir);
    }
}

From source file:com.github.ipaas.ideploy.agent.handler.BackupCodeHandler.java

@Override
public void execute(String flowId, String cmd, Map<String, Object> params, BundleContext bundleContext)
        throws Exception {
    logger.debug("?  flowId:" + flowId + "  cmd:" + cmd + "  params:" + params);

    String srcPath = String.valueOf(params.get("srcPath"));
    String targetPath = String.valueOf(params.get("targetPath"));

    File srcDir = new File(srcPath);

    // ?/*from   w  w w. ja va 2 s .  co m*/
    if (!srcDir.exists()) {
        return;
    }

    File destDir = new File(targetPath);

    // 
    if (destDir.exists() || destDir.getParentFile().exists()) {
        FileUtils.cleanDirectory(destDir.getParentFile());
    } else {
        FileUtils.forceMkdir(destDir);
    }

    // 
    FileUtils.copyDirectory(srcDir, destDir);

    logger.debug("??...");
}