mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Improve CleanBackupsTask a bit
* Print proper file names to the console when the date could not be determined * Skip all directories * Skip every file that doesn’t have .zip in the file name
This commit is contained in:
parent
cdcda03e92
commit
6c2b1f555f
@ -33,17 +33,16 @@ public class CleanBackupsTask extends BukkitRunnable {
|
|||||||
|
|
||||||
// Check files in backup folder from oldest to newest
|
// Check files in backup folder from oldest to newest
|
||||||
for (File file : BACKUP_DIR.listFiles()) {
|
for (File file : BACKUP_DIR.listFiles()) {
|
||||||
if (!file.isFile()) {
|
if (!file.isFile() || file.isDirectory()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
amountTotal++;
|
amountTotal++;
|
||||||
String fileName = file.getName();
|
String fileName = file.getName();
|
||||||
fileName = fileName.split("[.]")[0];
|
|
||||||
|
|
||||||
Date date = getDate(fileName);
|
Date date = getDate(fileName.split("[.]")[0]);
|
||||||
|
|
||||||
if (date == null) {
|
if (!fileName.contains(".zip") || date == null) {
|
||||||
mcMMO.p.debug("Could not determine date for file: " + fileName);
|
mcMMO.p.debug("Could not determine date for file: " + fileName);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user