private void init(boolean keepExistingData) { groupFiles = new HashMap<String, File>(); if (rootDirFile.exists()) { if (keepExistingData) { /* Load information about existing groups */ File[] existingFileGroups = rootDirFile.listFiles( new FileFilter() { public boolean accept(File f) { return f.isDirectory(); } }); for (File groupDirFile : existingFileGroups) { groupFiles.put(groupDirFile.getName(), groupDirFile); } } else { /* load all existing file groups */ FileUtils.deleteDir(rootDirFile); rootDirFile.mkdirs(); } } else { rootDirFile.mkdirs(); } }
public void delete() { FileUtils.deleteDir(rootDirFile); }