Created
March 8, 2013 12:43
-
-
Save cfalzone/5116242 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void cleanHostFromSitemapFiles(Host host){ | |
FolderAPI folderAPI = APILocator.getFolderAPI(); | |
FileAPI fileAPI = APILocator.getFileAPI(); | |
Folder folder = null; | |
try { | |
folder = folderAPI.findFolderByPath(XML_SITEMAPS_FOLDER, host, systemUser, true); | |
} catch(Exception e) { | |
Logger.error(this, "Not able to find the folder", e); | |
return; | |
} | |
if (InodeUtils.isSet(folder.getInode())) { | |
List<File> files = null; | |
try { | |
files = folderAPI.getFiles(folder, systemUser, false); | |
} catch(Exception e) { | |
Logger.error(this, "Not able to get the files in the folder", e); | |
return; | |
} | |
for (File file : files) { | |
try { | |
fileAPI.delete((File) file, systemUser, false); | |
} catch(Exception e) { | |
Logger.error(this, "Could not delete the file: "+file.getFileName(), e); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment