• Great code.. so great and I am trying to use it! How would I run this against multiple locations (servers) without having to create a completely different job?

    Right now my "totally stolen" code looks like this:

    Hello,

    Sorry to bother you.. but I am trying to use some code you posted long ago in 2008. It worked great but I am trying to remove files from 2 different locations (servers). I was hoping you can help me..

    Right now my code looks like this..

    Option Explicit

    on error resume next

    Dim oFSO

    Dim sDirectoryPath

    Dim oFolder

    Dim oFileCollection

    Dim oFile

    Dim iDaysOld

    'Customize values to clear Reports

    'Question is here.. how do I loop around to grab a second location?

    iDaysOld = 90

    Set oFSO = CreateObject("Scripting.FileSystemObject")

    sDirectoryPath = "\\LIBERTY\Tailsheets"

    set oFolder = oFSO.GetFolder(sDirectoryPath)

    set oFileCollection = oFolder.Files

    'Walk through each file in this folder collection.

    'If it is older than 3 months (90) days, then delete it.

    For each oFile in oFileCollection

    If oFile.DateLastModified < (Date() - iDaysOld) Then

    oFile.Delete(True)

    End If

    Next

    'Clean up

    Set oFSO = Nothing

    Set oFolder = Nothing

    Set oFileCollection = Nothing

    Set oFile = Nothing

    Any ideas?

    Thanks,

    Marvin