'自動化檔案維護管理程式
'天數
daysAgo = 20

'路徑
dirPath = "Z:\\"

'副檔名
extName = ".bak"

'定義變數backupnas

Dim backupnas

';;;;;程式開始;;;;;


'設定backupnas連線網路磁碟機I

Set backupnas = CreateObject("WScript.Network")
backupnas.MapNetworkDrive "z:", "\\ps-ehrd-bkup\rdel-sql2-dt" ,"True","backupadm","vm4xu06"


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

'backupnas.RemoveNetworkDrive "Z:"
backupnas.RemoveNetworkDrive "Z:","True","True"

-----------------------------------------------------------------------------------------------------

2  

 

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 chengyu0701988 的頭像
    chengyu0701988

    chengyu0701988的部落格

    chengyu0701988 發表在 痞客邦 留言(0) 人氣()