Board logo

標題: 如何刪除指定日期以前的檔案/資料夾 [打印本頁]

作者: dtom    時間: 2009-1-13 13:51     標題: 如何刪除指定日期以前的檔案/資料夾

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

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

依家每日要我手動刪除 CAM1-CAM10 7 日後既資料夾... 仲有幾個 site
作者: DrERY    時間: 2009-1-14 01:44


作者: dtom    時間: 2009-1-14 08:50     標題: 回復 2# 的帖子

就係唔想人手做
我放假就無人跟, CCTV 死左老闆又打電話黎...
作者: yo哥哥    時間: 2009-1-14 09:23

Window 2000 / XP 可以考慮用 System Tool / Scheduled Task 搭 VBScript 寫 vbs
Scheduled Task 行唔行到 bat file 我就未試過
作者: achau01    時間: 2009-1-14 09:46

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.
作者: nobodylam    時間: 2009-1-14 22:33

FYI

http://forums.techguy.org/dos-pd ... delete-folders.html

You can refer to post #9
作者: nobodylam    時間: 2009-1-14 23:06

  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





歡迎光臨 電腦領域 HKEPC Hardware (https://h0.hkepc.com/forum/) Powered by Discuz! 7.2