如何刪除指定日期以前的檔案/資料夾

公司有一部電腦儲存 CCTV  Video,
但係個 program 唔識刪除舊資料, 攪到 hdd full 左之後個cctv就不斷 reset
有無方法 (bat / 軟件) 可以刪除指定日前以後既資料夾+檔案呢

檔案會係咁
CAM1-CAM10↓  ↓年月日  ↓年月日時分秒百分秒(其實檔案可以不理,資料夾內全部刪除都得)
D:\CCTV\CAM1\20090113\20090113133030.avi

依家每日要我手動刪除 CAM1-CAM10 7 日後既資料夾... 仲有幾個 site

TOP

回復 2# 的帖子

就係唔想人手做
我放假就無人跟, CCTV 死左老闆又打電話黎...

TOP

Window 2000 / XP 可以考慮用 System Tool / Scheduled Task 搭 VBScript 寫 vbs
Scheduled Task 行唔行到 bat file 我就未試過

TOP

If you know how to write VB or C# program, you can write a very simple program to do this.  Then schedule to run your program everyday.

TOP

TOP

  1. @Echo off
  2. :: User Variables
  3. :: Set this to the number of folders you want to keep
  4. Set _NumtoKeep=1
  5. :: Set this to the folder that contains the folders to check and delete
  6. Set _Path=D:\CCTV\CAM
  7. :: Set this to the number of cameras
  8. Set _NumCam=10

  9. For /l %%i In (1,1,%_NumCam%) Do (
  10. PushD %_Path%%%i
  11. Set _rdflag= /q
  12. For /F "tokens=* skip=%_NumtoKeep%" %%I In ('dir "%_Path%%%i" /AD /B /O-D /TW') Do (
  13.   rd /s /q %%~fI
  14. )
  15. PopD
  16. )
複製代碼
Save this as a bat file and create a schedule job to run it everyday

TOP