Your technology certification is waiting. Enroll in Cloud Class ®
Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.
Const conBaseDir = "C:\EE\Temp"
Const conDelAge = 7
' Create file system object
Set objFSO = WScript.CreateObject("Scripting.FileSystemObject")
' Call recursive routine to clean out old folders
CleanFolder objFSO.GetFolder(conBaseDir), conDelAge
' Release file system object
Set objFSO = Nothing
' Recursive subroutine to remove old subfolders
Sub CleanFolder(objFolder, intAge)
' See if this folders subfolders are old enough to delete.
For Each objSubFolder In objFolder.SubFolders
If DateDiff("d", objSubFolder.DateCreated, Now) >= intAge Then
Wscript.Echo "Deleted Folder: [" & objSubFolder.Path & "], Age: [" & DateDiff("d", objSubFolder.DateCreated, Now) & "]"
CleanFolder objSubFolder, intAge
Open in new window
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.