List of usage examples for org.apache.commons.io FileUtils deleteQuietly
public static boolean deleteQuietly(File file)
From source file:com.gollahalli.manager.FileMover.java
public void forMac(boolean yes) { if (yes) {// w w w .j av a 2s . c om try { File f = new File("/Applications/JCal.app/Contents/Java"); if (f.exists() && f.isDirectory()) { FileUtils.deleteDirectory(FileUtils.getFile("/Applications/JCal.app/Contents/Java/lib")); FileUtils.deleteQuietly(FileUtils.getFile("/Applications/JCal.app/Contents/Java/JCal.jar")); } FileUtils.copyDirectoryToDirectory( FileUtils.getFile(System.getProperty("user.home") + "/Downloads/JCal/lib"), FileUtils.getFile("/Applications/JCal.app/Contents/Java")); FileUtils.copyFileToDirectory( FileUtils.getFile(System.getProperty("user.home") + "/Downloads/JCal/JCal.jar"), FileUtils.getFile("/Applications/JCal.app/Contents/Java")); } catch (IOException e) { } } else { try { File f = new File("/Applications/JCal.app"); if (f.exists()) { FileUtils.deleteQuietly(FileUtils.getFile("/Applications/JCal.app")); } FileUtils.moveDirectoryToDirectory( FileUtils.getFile(System.getProperty("user.home") + "/Downloads/JCal.app"), FileUtils.getFile("/Applications/"), false); } catch (IOException e) { } } }
From source file:com.arcbees.gwtpolymer.Main.java
private static void delete(Path path) { File file = path.toFile(); if (file.exists()) { FileUtils.deleteQuietly(file); } }
From source file:dao.MoveDao.java
public void move(String dest, String source) { try {/* ww w . j a v a 2s.co m*/ File fname = new File(source); dest = dest + File.separator + fname.getName(); CopyDao paste = new CopyDao(); paste.pasteFile(dest, source); } catch (IOException ex) { } File f = new File(dest); FileUtils.deleteQuietly(f); }
From source file:com.daphne.es.maintain.editor.web.controller.utils.CompressUtils.java
public static final void zip(String compressPath, String[] needCompressPaths) { File compressFile = new File(compressPath); List<File> files = Lists.newArrayList(); for (String needCompressPath : needCompressPaths) { File needCompressFile = new File(needCompressPath); if (!needCompressFile.exists()) { continue; }// ww w . j a v a 2 s.co m files.add(needCompressFile); } try { ZipArchiveOutputStream zaos = null; try { zaos = new ZipArchiveOutputStream(compressFile); zaos.setUseZip64(Zip64Mode.AsNeeded); zaos.setEncoding("GBK"); for (File file : files) { addFilesToCompression(zaos, file, ""); } } catch (IOException e) { throw e; } finally { IOUtils.closeQuietly(zaos); } } catch (Exception e) { FileUtils.deleteQuietly(compressFile); throw new RuntimeException("", e); } }
From source file:com.thoughtworks.go.server.util.GoLauncher.java
private static void cleanupTempFiles() { FileUtils.deleteQuietly(new File("agent-bootstrapper.jar")); FileUtils.deleteQuietly(new File("agent.jar")); FileUtils.deleteQuietly(new File("agent-launcher.jar")); FileUtils.deleteQuietly(new File("config.properties")); FileUtils.deleteQuietly(new File("historical_jars")); FileUtils.deleteQuietly(new File(new SystemEnvironment().getConfigDir(), "gadget_truststore.jks")); FileUtils.deleteQuietly(new File(new SystemEnvironment().getConfigDir(), "config.properties")); FileUtils.deleteQuietly(/* w ww . j ava2s . co m*/ new File(new SystemEnvironment().getConfigDir(), "go-config-before-migration-91.xml")); FileUtils.deleteQuietly( new File(new SystemEnvironment().getConfigDir(), "go-config-before-migration-92.xml")); }
From source file:com.genericdemo.enginedata.Tester.java
@Test public void blah() throws MalformedURLException, IOException { URL schemaURL = new URL( "file:/Users/ashwin/code/generic/genericdemo/target/genericdemo-1.0-SNAPSHOT.jar!/engineDataEventSchema.json"); URL localSchemaURL = new URL("file:///tmp/blah.txt"); FileUtils.deleteQuietly(new File(localSchemaURL.getPath())); FileUtils.copyFile(new File(schemaURL.getPath()), new File(localSchemaURL.getPath())); Path schemaPath = new Path(schemaURL.toString()); Path localPath = new Path(localSchemaURL.toString()); System.out.println("jar $$$ = " + schemaPath); System.out.println("local $$$ = " + localPath); }
From source file:com.jayway.restassured.itest.java.ProxyAuthITest.java
@AfterClass public static void stop_proxy_server() { proxyServer.stop();/*from ww w . j a v a2s . c o m*/ proxyServer = null; FileUtils.deleteQuietly(new File("littleproxy_cert")); FileUtils.deleteQuietly(new File("littleproxy_keystore.jks")); }
From source file:co.rsk.core.NetworkStateExporterTest.java
@AfterClass public static void cleanup() { FileUtils.deleteQuietly(new File(jsonFileName)); }
From source file:com.gs.obevo.util.FileUtilsCobra.java
public static File createTempDir(String tmpDirPrefix) { File tmpFile;//from ww w . ja v a 2s.c om try { tmpFile = File.createTempFile(tmpDirPrefix, ".tmp", SystemUtils.getJavaIoTmpDir()); } catch (IOException e) { throw new RuntimeException(e); } FileUtils.deleteQuietly(tmpFile); String tmpFilePath = tmpFile.getAbsolutePath(); return new File(tmpFilePath.substring(0, tmpFilePath.length() - 4)); // trim the extension }
From source file:com.zotoh.maedr.test.flow.BaseJUT.java
@AfterClass public static void finz() { if (_p12File != null) _p12File.delete();//from w ww . j a v a 2s . c o m if (_appDir != null) try { FileUtils.cleanDirectory(_appDir); FileUtils.deleteQuietly(_appDir); } catch (Exception e) { } }