Example usage for com.google.common.io MoreFiles deleteDirectoryContents

List of usage examples for com.google.common.io MoreFiles deleteDirectoryContents

Introduction

In this page you can find the example usage for com.google.common.io MoreFiles deleteDirectoryContents.

Prototype

public static void deleteDirectoryContents(Path path, RecursiveDeleteOption... options) throws IOException 

Source Link

Document

Deletes all files within the directory at the given path #deleteRecursively recursively .

Usage

From source file:neon.common.files.FileUtils.java

/**
 * Clears all content from the given folder.
 * /*from   w  w w  .j  a v  a2  s. c o m*/
 * @param folder
 */
public static void clearFolder(Path folder) {
    logger.info("clearing folder " + folder);

    try {
        MoreFiles.deleteDirectoryContents(folder, RecursiveDeleteOption.ALLOW_INSECURE);
    } catch (IOException e) {
        throw new IllegalArgumentException("can't clear folder " + folder, e);
    }
}