如何检索出最近日期的文件

来源:百度知道 编辑:UC知道 时间:2024/06/16 21:34:51
我这有个数据库软件,设置的是自动备份的,备份的文件是以日期作为文件名的,例如2009-11-25.bak,请问是否有软件或批处理命令能够自动的检测出最后的备份时间,并改名为access.mdb?
谢谢

Set fso = CreateObject("Scripting.FileSystemObject")

Function sd(m)
Dim fso, f, f1, fc, nd, nn
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(m)
Set fc = f.Files

For Each f1 in fc
If nd = "" Then
nd = f1.DateCreated
nn = f1.name
End If

If nd < f1.DateCreated Then
nd = f1.DateCreated
nn = f1.name
End if
Next

FSO.MoveFile m&"\"&nn , m&"\access.mdb"

End Function

document.write sd("c:\")

-------------------------------------------
上面代码是将c盘最后创建的一个文件更名为access.mdb