jbla9028
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.Fi leSystemOb ject")
sDirectoryPath = "\\d0002\D\test"
set oFolder = oFSO.GetFolder(sDirectoryP ath)
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
iDaysOld = 1
Set oFSO = CreateObject("Scripting.Fi
sDirectoryPath = "\\d0002\D\test"
set oFolder = oFSO.GetFolder(sDirectoryP
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER