List of usage examples for org.apache.commons.io FileUtils deleteQuietly
public static boolean deleteQuietly(File file)
From source file:cereal.examples.thrift.ThriftPersonTest.java
@BeforeClass public static void start() throws IOException, InterruptedException { File target = new File(System.getProperty("user.dir") + "/target"); assertTrue(target.exists());//from w w w . jav a 2 s .co m assertTrue(target.isDirectory()); File macParent = new File(target, "minicluster"); macParent.mkdirs(); File macDir = new File(macParent, ThriftPersonTest.class.getName()); if (macDir.exists()) { FileUtils.deleteQuietly(macDir); } MiniAccumuloConfig cfg = new MiniAccumuloConfig(macDir, PASSWORD); cfg.setNumTservers(1); mac = new MiniAccumuloCluster(cfg); mac.start(); }
From source file:com.wenzani.maven.mongodb.CleanMongoDb.java
public void execute() throws MojoExecutionException { FileUtils.deleteQuietly(new File(mongoDbDir)); }
From source file:com.hp.test.framework.Reporting.cleanTempDir.java
public static void cleanandCreate(String Reports_path, int last_run) { String temp_path = Reports_path + "\\temp"; deleteDir(new File(temp_path)); File file = new File(temp_path); boolean isDirectoryCreated = file.mkdir(); if (isDirectoryCreated) { log.info("successfully Created directory"); } else {/* w ww . j a v a 2 s . c om*/ file.delete(); file.mkdir(); log.info("deleted and Created directory"); } File trgDir = new File(temp_path); File srcDir = new File(Reports_path); try { FileUtils.copyDirectory(srcDir, trgDir); log.info("Copying reports to temp path is completed"); } catch (IOException ex) { log.error("Issue with the copying reports to temp directory" + ex.getMessage()); } try { removerunlinks.removelinksforpreRuns(temp_path + "\\results\\", "ConsolidatedPage.html", last_run); } catch (IOException ex) { log.error("Error in removing links from the page ConsolidatedPage.html" + ex.getMessage()); } for (int i = 1; i < last_run; i++) { try { deleteDir(new File(temp_path + "\\results\\Run_" + i)); } catch (Exception ex) { log.error("Not able to delete directory" + temp_path + "\\results\\Run_" + i); } log.error("Deleted" + temp_path + "\\results\\Run_" + i); } FileUtils.deleteQuietly(new File(temp_path + "\\ISTF_Reports.zip")); // ZipUtils.ZipFolder(temp_path, Reports_path+); }
From source file:com.enonic.cms.itest.home.HomeDirFactory.java
@Override public void destroy() { FileUtils.deleteQuietly(this.homeDir.toFile()); }
From source file:edu.harvard.hul.ois.fits.junit.AudioStdSchemaTestXmlUnit_NoMD5.java
@AfterClass public static void tearDownAfterClass() throws Exception { System.out.println("Resetting fits.xml"); // Set the backup to the original fits.xml FileUtils.copyFile(FileUtils.getFile("xml/fits_back.xml"), FileUtils.getFile("xml/fits.xml")); // Remove the temp file FileUtils.deleteQuietly(FileUtils.getFile("xml/fits_back.xml")); }
From source file:de.science.hack.FileModelWriterTest.java
@After public void shutDown() { FileUtils.deleteQuietly(resultFile); }
From source file:gov.nih.nci.caintegrator.application.arraydata.NetCDFDeleter.java
void deleteGisticAnalysisNetCDFFile(Study study, Long reporterListId) { File fileToDelete = getFile(study, reporterListId, ReporterTypeEnum.GISTIC_GENOMIC_REGION_REPORTER); String filePath = fileToDelete.getPath(); if (FileUtils.deleteQuietly(fileToDelete)) { LOGGER.info("Deleted file: " + filePath); }/*w ww. j a v a 2 s . c o m*/ }
From source file:fr.inria.atlanmod.neoemf.extension.Workspace.java
@Override public void after() { if (nonNull(temporaryFolder) && temporaryFolder.exists() && !FileUtils.deleteQuietly(temporaryFolder)) { try {// w w w . j a va 2s . c om FileUtils.forceDeleteOnExit(temporaryFolder); } catch (IOException ignore) { } } }
From source file:com.cloudant.sync.util.TestUtils.java
public static void deleteDatabaseQuietly(SQLDatabase database) { try {//from ww w. jav a 2 s . c o m if (database != null) { database.close(); } } catch (Exception e) { } try { if (database != null) { FileUtils.deleteQuietly(new File(database.filename)); } } catch (Exception e) { } }
From source file:ch.entwine.weblounge.contentrepository.impl.index.elasticsearch.ElasticSearchUtils.java
/** * Creates an elastic search index configuration inside the given directory by * loading the relevant configuration files from the bundle. The final * location will be <code>homeDirectory/etc/index</code>. * //w ww . j ava2 s . c om * @param homeDirectory * the configuration directory * @throws IOException * if creating the configuration fails */ public static void createIndexConfigurationAt(File homeDirectory) throws IOException { // Load the index configuration and move it into place File configurationRoot = new File(PathUtils.concat(homeDirectory.getAbsolutePath(), "etc", "index")); FileUtils.deleteQuietly(configurationRoot); if (!configurationRoot.mkdirs()) throw new IOException("Error creating " + configurationRoot); String[] files = new String[] { "default-mapping.json", "file-mapping.json", "image-mapping.json", "movie-mapping.json", "names.txt", "page-mapping.json", "settings.yml", "version-mapping.json" }; for (String file : files) { String bundleLocation = UrlUtils.concat("/elasticsearch", file); File fileLocation = new File(configurationRoot, file); FileUtils.copyInputStreamToFile(ElasticSearchUtils.class.getResourceAsStream(bundleLocation), fileLocation); } }