use of com.trivago.rta.exceptions.filesystem.FileDeletionException in project cucable-plugin by trivago.
the class FileSystemManager method removeFilesFromPath.
/**
* Removes files with the specified extension from the given path.
*
* @param path The path to clear.
* @param fileExtension The file extension to consider.
*/
private void removeFilesFromPath(final String path, final String fileExtension) throws FileDeletionException {
File basePath = new File(path);
File[] files = basePath.listFiles();
if (files != null) {
for (File file : files) {
if (file.getName().endsWith("." + fileExtension) && !file.delete()) {
throw new FileDeletionException(file.getName());
}
}
}
}
Aggregations