优化删除无用文件
This commit is contained in:
parent
bad2cbc494
commit
28983836e7
|
|
@ -147,7 +147,9 @@ public class BackupTask {
|
|||
public void deleteTmpFile() {
|
||||
DateTime backDaysTime = DateUtil.offsetHour(new Date(), -elePropertyConfig.getTmpFileStoreHour());
|
||||
FileFilter filter = file -> file.lastModified() < backDaysTime.getTime();
|
||||
List<File> files = FileUtil.loopFiles(elePropertyConfig.getEleTmpPath(), filter);
|
||||
List<String> dirs = List.of(elePropertyConfig.getEleTmpPath(), elePropertyConfig.getRepoDownloadPath(), elePropertyConfig.getSysDownloadPath(), elePropertyConfig.getUserDownloadPath());
|
||||
for (String dir : dirs) {
|
||||
List<File> files = FileUtil.loopFiles(dir, filter);
|
||||
for (File file : files) {
|
||||
fileSystemService.deleteFile(file.getAbsolutePath());
|
||||
UserAccessLog userAccessLog = new UserAccessLog()
|
||||
|
|
@ -171,6 +173,7 @@ public class BackupTask {
|
|||
log.info("删除文件成功,路径 {}", file.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Scheduled(cron = "0 0 * * * ?")
|
||||
public void backupSql() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue