投稿者 shu  (社会人) 投稿日時 2012/5/18 15:05:23
こんな感じでしょうか?

Option Explicit

Dim objFSO
Dim Folder
Dim SubFolders
Dim reg

Set objFSO = WScript.CreateObject("Scripting.FileSystemObject")

Set reg = New RegExp
reg.Pattern = "^(\d{4})_(\d{2})_(\d{2})$"

Set Folder = objFSO.GetFolder("A")
SubFolderParse Folder


Sub SubFolderParse(Folder)
    Dim SubFolder
    Dim PathName
    Dim CreateDate

    PathName = Folder.Name
    if reg.Test(PathName) then
        CreateDate = DateValue(reg.Replace(PathName,"$1/$2/$3"))
        WScript.Echo Folder.Path & ":" & DateDiff("d",CreateDate,Date)
        If DateDiff("d",CreateDate,Date) >= 90 then
            Folder.Delete True
        End If
    Else
        Set SubFolders = Folder.SubFolders

        For Each SubFolder in SubFolders
            SubFolderParse(SubFolder)
        Next
    End if
End Sub