Delete all Files From Folder
13
mattrmiller
Deletes all files of a certain extention from a folder.
// Clears folder from the mess we make
public static void clearFolder(String strFolder, String strExt)
{
// Declare variables
File fLogDir = new File(strFolder);
// Get all BCS files
File[] fLogs = fLogDir.listFiles(new FilenameFilter()
{
public boolean accept(File fDir, String strName)
{
return (strName.endsWith("." + strExt));
}
});
// Delete all files
for (int i = 0; i < fLogs.length; i++)
{
deleteFile(fLogs[i].getAbsolutePath());
}
}






There are currently no comments for this snippet.