charlespliler
asked on
Script error 800a0046 Permission Denied
I have a script to delete files older than 15 minutes and it works great except on a couple Servers. I run it as a Domain Admin and get this error
Script: C;\FileCopy\test.vbs
Line: 8
Char: 9
Error: Permission denied
Code: 800a0046
Source: Microsoft VBScript runtime error
here is the script
Dim fso, f, f1, fc, result
Set fso = CreateObject("Scripting.Fi leSystemOb ject")
Set f = fso.GetFolder("D:\GCTI\log s")
Set fc = f.Files
For Each f1 in fc
result = DateDiff("n",f1.DateLastMo dified,Now )
If result > 15 Then
f1.Delete
End If
Next
Set fso = Nothing
Set f = Nothing
Set fc = Nothing
PLEASE HELP
Script: C;\FileCopy\test.vbs
Line: 8
Char: 9
Error: Permission denied
Code: 800a0046
Source: Microsoft VBScript runtime error
here is the script
Dim fso, f, f1, fc, result
Set fso = CreateObject("Scripting.Fi
Set f = fso.GetFolder("D:\GCTI\log
Set fc = f.Files
For Each f1 in fc
result = DateDiff("n",f1.DateLastMo
If result > 15 Then
f1.Delete
End If
Next
Set fso = Nothing
Set f = Nothing
Set fc = Nothing
PLEASE HELP
Is it possible the file is still in use when attempting to delete ?
ASKER
There are multiple files in the directory, is there something to add to the script to have it skip over a file if its in use and move on to the next??
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER