Link to home
Start Free TrialLog in
Avatar of jbla9028
jbla9028Flag for United States of America

asked on

can't use script to access UNC path?

I have borrowed this script from the interweb in order to delete files older than X days within a unc path. the script will work locally on the pc but when I put a UNC path in under "sDirectoryPath =" the script does not work. Any Ideas? I'm a network admin, not a programmer so any help would be highly appreciated!

iDaysOld = 1
Set oFSO = CreateObject("Scripting.FileSystemObject")
sDirectoryPath = "\\d0002\D\test"
set oFolder = oFSO.GetFolder(sDirectoryPath)
set oFileCollection = oFolder.Files
'If database log file backups are older than "iDaysOld" days, delete them.
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

Sub RecurseFolders(oFolder)
      set oFileCollection = oFolder.Files
      'If database log file backups are older than "iDaysOld" days, delete them.
      For each oFile in oFileCollection
            If oFile.DateLastModified < (Date() - iDaysOld) Then
                  oFile.Delete(True)
            End If
      Next      
      End Sub
ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jbla9028

ASKER

got it.  thanks!