以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]备份文件数量 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=57698) |
-- 作者:建筑人生 -- 发布时间:2014/9/29 14:24:00 -- [求助]备份文件数量 Static
dt
As
Date
\'静态变量,用于保存上次备份的时间 上面的代码只有备份文件,我想同样的文件名备份数量只有3个要怎么设置 |
-- 作者:Bin -- 发布时间:2014/9/29 14:26:00 -- http://www.foxtable.com/help/topics/0341.htm 遍历删除 留3个
|
-- 作者:lsy -- 发布时间:2014/9/29 15:15:00 -- e.Button.Enabled = False StatusBar.Message2 = "正在备份...请稍候..." StatusBar.Refresh Dim dt As String Dim nm As String For i As Integer = 1 To 3 Dim ifo As New FileInfo(ProjectPath & "备份\\bak" & i) If i = 1 Then dt = ifo.CreationTime nm = ifo.Name Else If ifo.CreationTime < dt Then dt = ifo.CreationTime nm = ifo.Name End If End If Next FileSys.DeleteDirectory(ProjectPath & "备份\\" & nm,2,2) FileSys.CreateDirectory(ProjectPath & "备份\\" & nm) Syscmd.Project.Backup(ProjectPath & "备份\\" & nm, True) StatusBar.Message2 = "" StatusBar.Refresh MessageBox.Show("完毕") e.Button.Enabled = True [此贴子已经被作者于2014-9-29 15:24:32编辑过]
|