'自動化檔案維護管理程式
'天數
daysAgo = 3
'路徑
dirPath = "C:\\test"
'副檔名
extName = ".bak"
';;;;;程式開始;;;;;
Set fs = CreateObject("Scripting.FileSystemObject")
Set w = WScript.CreateObject("WScript.Shell")
Set f = fs.GetFolder(dirPath)
Set fc = f.Files
dateBefore = Now() - daysAgo
For Each ff in fc
fileName = ff.Name
fileDate = ff.DateLastModified
If Right(fileName, Len(extName)) = extName And fileDate < dateBefore Then
fs.DeleteFile(dirPath & "\\" & fileName)
End If
Next
2007年5月22日
用VBScript自動刪除過期的檔案
以下的設定是刪除檔案修改時間為三日以前的C:\\test\\*.bak檔案。
訂閱:
張貼留言 (Atom)
可以參考 PML AUTODEL
回覆刪除http//www.pml-intl.com/autodel.exe
請問遺下喔~ 那有沒有辦法把 '天數
回覆刪除daysAgo = 3
'路徑
dirPath = "C:\\test"
'副檔名
extName = ".bak"
這三個 改成 自己設定的!? Ex : 在text那邊輸入~ 可以改嗎?
我想請問,若要刪除多個子資料夾要怎麼寫?
回覆刪除input
回覆刪除