Java Code Examples for org.apache.commons.io.FileUtils.cleanDirectory()

The following are Jave code examples for showing how to use cleanDirectory() of the org.apache.commons.io.FileUtils class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: monarch   File: ClusterConfigurationServiceEndToEndDUnitTest.java   View Source Code Vote up 6 votes
private void shutdownAll() throws IOException {
  VM locatorAndMgr = getHost(0).getVM(3);
  locatorAndMgr.invoke(new SerializableCallable() {
    @Override
    public Object call() throws Exception {
      GemFireCacheImpl cache = (GemFireCacheImpl) CacheFactory.getAnyInstance();
      ShutdownAllRequest.send(cache.getDistributedSystem().getDistributionManager(), -1);
      return null;
    }
  });

  locatorAndMgr.invoke(SharedConfigurationTestUtils.cleanupLocator);

  // Clean up the directories
  if (!serverNames.isEmpty()) {
    for (String serverName : serverNames) {
      final File serverDir = new File(serverName);
      FileUtils.cleanDirectory(serverDir);
      FileUtils.deleteDirectory(serverDir);
    }
  }
  serverNames.clear();
}
 
Example 2
Project: wherehowsX   File: GitUtil.java   View Source Code Vote up 6 votes
/**
 * Cloning the remote git repo to local directory
 * @param remoteUri remote git url e.g. git://gitli.example.com/project/repo.git
 * @param localDir local destination clone directory
 * @throws IOException
 * @throws GitAPIException
 */
public static void clone(String remoteUri, String localDir) throws IOException, GitAPIException {
  //create local git directory
  File localGitRepo = new File(localDir);
  if (localGitRepo.exists()) {
    if (localGitRepo.isDirectory()) {
      // clean up directory
      FileUtils.cleanDirectory(localGitRepo);
    } else {
      throw new IOException("File exists: " + localDir);
    }
  } else {
    localGitRepo.mkdirs();
  }

  Git g = Git.cloneRepository().setURI(remoteUri).setDirectory(localGitRepo).call();
  g.close();
}
 
Example 3
Project: Reer   File: GFileUtils.java   View Source Code Vote up 5 votes
public static void cleanDirectory(File directory) {
    try {
        FileUtils.cleanDirectory(directory);
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}
 
Example 4
Project: NanoMaven   File: NanoTempFileManager.java   View Source Code Vote up 5 votes
@Override
public void clear() {
    try {
        FileUtils.cleanDirectory(NANOHTTPD_TEMP);
    } catch (IOException e) {
        // acceptable
    }
}
 
Example 5
Project: NoraUi   File: CommonSteps.java   View Source Code Vote up 5 votes
@Conditioned
@Lorsque("Je vide le repertoire des téléchargements[\\.|\\?]")
@Given("I clean download directory[\\.|\\?]")
public void cleanDownloadDirectory(List<GherkinStepCondition> conditions) throws IOException {
    FileUtils.forceMkdir(new File(System.getProperty("user.dir") + File.separator + "downloadFiles"));
    FileUtils.cleanDirectory(new File(System.getProperty("user.dir") + File.separator + "downloadFiles"));
}
 
Example 6
Project: BEAST   File: SystemSpecificCompilerAndExecutioner.java   View Source Code Vote up 5 votes
/**
 * constructor creates an error checker that compiles the c code and passes
 * it on to a system specific compiler
 */
public SystemSpecificCompilerAndExecutioner() {
	// clear the folder where the files that get checked get saved to,
	// because sometimes they
	// persist from the last time BEAST was run
	try {
		FileUtils.cleanDirectory(new File(SuperFolderFinder.getSuperFolder() + pathToTempFolder));
	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
}
 
Example 7
Project: universal_storage_java_fs_api   File: UniversalFileStorage.java   View Source Code Vote up 5 votes
/**
 * This method cleans the context of this storage.  This method doesn't remove any file from the storage.
 * The method will clean the tmp folder to release disk usage.
 */
public void clean() throws UniversalIOException  {
    try {
       FileUtils.cleanDirectory(new File(this.settings.getTmp()));
    } catch (Exception e) {
        UniversalIOException error = new UniversalIOException(e.getMessage());
        this.triggerOnErrorListeners(error);
        throw error;
    }
}
 
Example 8
Project: universal_storage_java_fs_api   File: UniversalFileStorage.java   View Source Code Vote up 5 votes
/**
 * This method wipes the root folder of a storage, basically, will remove all files and folder in it.  
 * Be careful with this method because in too many cases this action won't provide a rollback action.
 */
public void wipe() throws UniversalIOException {
    try {
       FileUtils.cleanDirectory(new File(this.settings.getRoot()));
    } catch (Exception e) {
        UniversalIOException error = new UniversalIOException(e.getMessage());
        this.triggerOnErrorListeners(error);
        throw error;
    }
}
 
Example 9
Project: personium-core   File: SnapshotFileImportRunner.java   View Source Code Vote up 5 votes
/**
 * Delete cell webdav data.
 */
private void deleteWebDAV() {
    Path webdavRootPath = Paths.get(PersoniumUnitConfig.getBlobStoreRoot(),
            targetCell.getDataBundleName(), targetCell.getId());
    try {
        FileUtils.cleanDirectory(webdavRootPath.toFile());
    } catch (IOException e) {
        throw PersoniumCoreException.Common.FILE_IO_ERROR.params("delete WebDAV files").reason(e);
    }
}
 
Example 10
Project: hadoop   File: TestUnnecessaryBlockingOnHistoryFileInfo.java   View Source Code Vote up 5 votes
@BeforeClass
public static void setUp() throws IOException {
  if(USER_DIR.exists()) {
    FileUtils.cleanDirectory(USER_DIR);
  }
  USER_DIR.mkdirs();
}
 
Example 11
Project: airtable.java   File: WireMockBaseTest.java   View Source Code Vote up 5 votes
public static void cleanExistingRecords() {

        File mappings = new File("src/test/resources/mappings");
        File bodyFiles = new File("src/test/resources/__files");

        try {
            FileUtils.cleanDirectory(mappings);
            FileUtils.cleanDirectory(bodyFiles);
        } catch (IOException ex) {
            System.out.println("Exception deleting Files: " + ex);
        }
    }
 
Example 12
Project: cas-server-4.2.1   File: JsonServiceRegistryDaoTests.java   View Source Code Vote up 4 votes
@BeforeClass
public static void prepTests() throws Exception {
    FileUtils.cleanDirectory(RESOURCE.getFile());
}
 
Example 13
Project: springboot-shiro-cas-mybatis   File: JsonServiceRegistryDaoTests.java   View Source Code Vote up 4 votes
@BeforeClass
public static void prepTests() throws Exception {
    FileUtils.cleanDirectory(RESOURCE.getFile());
}
 
Example 14
Project: springboot-shiro-cas-mybatis   File: JsonServiceRegistryDaoTests.java   View Source Code Vote up 4 votes
@BeforeClass
public static void prepTests() throws Exception {
    FileUtils.cleanDirectory(RESOURCE.getFile());
}
 
Example 15
Project: springboot-shiro-cas-mybatis   File: OAuthRegisteredServiceTests.java   View Source Code Vote up 4 votes
@BeforeClass
public static void prepTests() throws Exception {
    FileUtils.cleanDirectory(RESOURCE.getFile());
}
 
Example 16
Project: cas-5.1.0   File: GrouperRegisteredServiceAccessStrategyRegistryTests.java   View Source Code Vote up 4 votes
@BeforeClass
public static void prepTests() throws Exception {
    FileUtils.cleanDirectory(RESOURCE.getFile());
}
 
Example 17
Project: cas-5.1.0   File: SamlRegisteredServiceTests.java   View Source Code Vote up 4 votes
@BeforeClass
public static void prepTests() throws Exception {
    FileUtils.cleanDirectory(RESOURCE.getFile());
}
 
Example 18
Project: cas-5.1.0   File: OidcRegisteredServiceTests.java   View Source Code Vote up 4 votes
@BeforeClass
public static void prepTests() throws Exception {
    FileUtils.cleanDirectory(RESOURCE.getFile());
}
 
Example 19
Project: cas-5.1.0   File: OAuthRegisteredServiceTests.java   View Source Code Vote up 4 votes
@BeforeClass
public static void prepTests() throws Exception {
    FileUtils.cleanDirectory(RESOURCE.getFile());
}
 
Example 20
Project: cas-server-4.2.1   File: GrouperRegisteredServiceAccessStrategyRegistryTests.java   View Source Code Vote up 4 votes
@BeforeClass
public static void prepTests() throws Exception {
    FileUtils.cleanDirectory(RESOURCE.getFile());
}