Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

delete log files error

Status
Not open for further replies.

dukekern

MIS
Jan 16, 2003
6
US
I run the script on me dev server (2003 SP1) and it runs fine. I run it in our test environment (2003 SP2) and I get a permission denied run time error. I am running it under an account with admin privledges to the server. Is there something with SP2 and vb scripts that doesn't play nice? Here is the script for review:

Dim fso, f, f1, fc
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder("D:\Program Files\aaaaa\bbbb\logfiles")
Set fc = f.Files
For Each f1 in fc
If DateDiff("d", f1.DateLastModified, Now) > 14 Then f1.Delete
Next
 
Simple things to check:

Are the files in this directory?

Are the files protected in some way?

Are the files in use?

Try adding some debugging code, like a messagebox that pops up with the file about to be deleted. Once you can see which file(s) are the root of the problem, it's esier to work out what's up.

Cheers,
Dave

"Yes, I'll stop finding bugs in the software - as soon as you stop writing bugs into the software." <-- Me

For all your testing needs: Forum1393
 
The files are they are the rights are sound. The files wouldn't be in use as they are old and that is why we want them pruned. I'm still a newbie with the scripting and wouldn't know how to do the message box unfortunatley.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top