本帖最后由 batman 于 2013-9-13 15:55 编辑
- '代码暂没有考虑多级目录备份的情况
- Dim objFSO, MyPath, BackPath, File, MinDay
- MyPath = "要执行备份的目录路径"
- BackPath = "备份目录路径,最后的\必须加上"
- MinDay = DateAdd("d", -7, Now)
- Set objFSO = CreateObject("Scripting.FileSystemObject")
- '如果是在当前目录下执行备份可用以下代码获取MyPath
- 'MyPath = objFSO.GetFile(WScript.ScriptFullName).ParentFolder
- For Each File In objFSO.GetFolder(MyPath).Files
- If File.DateCreated >= MinDay Then _
- objFSO.CopyFile File, BackPath, True
- Next
- Set objFSO = Nothing
复制代码
|