求朋友们帮忙修必下下面的VBS代码!!!
原数据库备份后的文件夹名称为:2011-06-30;2011-07-01;2011-07-02;2011-07-03;2011-07-04;2011-07-05;文件夹内...
原数据库备份后的文件夹名称为:
2011-06-30;
2011-07-01;
2011-07-02;
2011-07-03;
2011-07-04;
2011-07-05;
文件夹内为数据库的备份文件,现考虑只保存最后两天的文件夹,得到以下VBS代码
Dim strDate
strFolder = "e:\test"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objfld = objfso.GetFolder(strfolder)
Set objsflds = objfld.SubFolders
For Each objsfld In objsflds
strDate = Split(objsfld.Name," ")
If DateDiff("d",strDate(0),Date) > 1 Then
objfso.DeleteFolder objsfld
End If
现数据库备份后的文件夹名称为:
20110630;
20110701;
20110702;
20110703;
20110704;
20110705;
如何修改上面的VBS代码后,保留20110704 20110705文件,其他都删除,谢谢 展开
2011-06-30;
2011-07-01;
2011-07-02;
2011-07-03;
2011-07-04;
2011-07-05;
文件夹内为数据库的备份文件,现考虑只保存最后两天的文件夹,得到以下VBS代码
Dim strDate
strFolder = "e:\test"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objfld = objfso.GetFolder(strfolder)
Set objsflds = objfld.SubFolders
For Each objsfld In objsflds
strDate = Split(objsfld.Name," ")
If DateDiff("d",strDate(0),Date) > 1 Then
objfso.DeleteFolder objsfld
End If
现数据库备份后的文件夹名称为:
20110630;
20110701;
20110702;
20110703;
20110704;
20110705;
如何修改上面的VBS代码后,保留20110704 20110705文件,其他都删除,谢谢 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询