| | |
| | | } |
| | | |
| | | /** |
| | | * 录像保持2天 |
| | | * 录像保持7天 |
| | | */ |
| | | @Scheduled(cron= "0 0 2 * * ?") |
| | | @Scheduled(cron= "0 0 7 * * ?") |
| | | public void recordRecycle(){ |
| | | log.info("-----------执行录像循环----------:"+ DateUtil.YYYY_MM_DD_HH_MM_SS.format(new Date())); |
| | | //文件夹路径 /battery_system/video_system/Debug/www/record/rtp/{streamId}/{day}} |
| | |
| | | List<String> dirList2 = Arrays.asList(dirList); |
| | | |
| | | for (int i = 0; i < dirList2.size()-3; i++) { |
| | | //按顺序删除,保留最后3个day的视频录像文件夹 |
| | | //按顺序删除,保留最后7个day的视频录像文件夹 |
| | | String dirPath2Remove = dirPath + File.separator + dirList2.get(i); |
| | | File dir2Remove = new File(dirPath2Remove); |
| | | FileUtil.deleteFile(dir2Remove); |