Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Delete files script error with SP2

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,59982
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Delete files script error with SP2
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Delete files script error with SP2 - 5/8/2008 1:46:21 AM   
  dukekern

 

Posts: 8
Score: 0
Joined: 4/30/2008
Status: offline
I have a script that deletes files more than 2 weeks old from a particular directory. It works fine with W2K3 server SP1 but with SP2 I get a "permission denied" error on line 6 of the code. What's different and how do I force it to do what I want on SP2?

Dim fso, f, f1, fc
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder("C:\nbexe\x86")
Set fc = f.Files
For Each f1 in fc
If DateDiff("d", f1.DateLastModified, Now) > 14 Then f1.Delete
Next
 
 
Post #: 1
 
 RE: Delete files script error with SP2 - 5/8/2008 1:55:52 AM   
  ebgreen


Posts: 4408
Score: 29
Joined: 7/12/2005
Status: offline
Is this being run as a stand alone vbs or is it in an HTML/HTA file?

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to dukekern)
 
 
Post #: 2
 
 RE: Delete files script error with SP2 - 5/8/2008 1:57:24 AM   
  dukekern

 

Posts: 8
Score: 0
Joined: 4/30/2008
Status: offline
stand alone vbs being called by a scheduled task.

(in reply to ebgreen)
 
 
Post #: 3
 
 RE: Delete files script error with SP2 - 5/8/2008 2:00:50 AM   
  ebgreen


Posts: 4408
Score: 29
Joined: 7/12/2005
Status: offline
In that case it would be an account permissions issue.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to dukekern)
 
 
Post #: 4
 
 RE: Delete files script error with SP2 - 5/8/2008 2:02:58 AM   
  dukekern

 

Posts: 8
Score: 0
Joined: 4/30/2008
Status: offline
Permissions are the same for the directory where the script is being run and the directory that the files are to be deleted from. That was the first thing I checked. The only difference being the service packs that I can see.

(in reply to ebgreen)
 
 
Post #: 5
 
 RE: Delete files script error with SP2 - 5/8/2008 2:04:25 AM   
  ebgreen


Posts: 4408
Score: 29
Joined: 7/12/2005
Status: offline
Are the accounts the same?

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to dukekern)
 
 
Post #: 6
 
 RE: Delete files script error with SP2 - 5/8/2008 2:06:16 AM   
  dukekern

 

Posts: 8
Score: 0
Joined: 4/30/2008
Status: offline
Yes, I'm using the same admin account for both jobs.

(in reply to ebgreen)
 
 
Post #: 7
 
 RE: Delete files script error with SP2 - 5/8/2008 2:14:04 AM   
  ebgreen


Posts: 4408
Score: 29
Joined: 7/12/2005
Status: offline
I don't know what to tell you then. There is nothing in SP2 that changed the way the .delete method worked. So since the same code works on some machines but not on one, the issue is environmental and I don't have access to your environment to troubleshoot it.

"It's not what you look at that matters, it's what you see."
- Henry David Thoreau


You say that the permissions are the same and the the accounts are the same, but the error that you are getting says otherwise.


There is one other possibility for you to look at, if the file is open it would give that error as well.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to dukekern)
 
 
Post #: 8
 
 RE: Delete files script error with SP2 - 5/8/2008 2:20:05 AM   
  dukekern

 

Posts: 8
Score: 0
Joined: 4/30/2008
Status: offline
I appreciate your help. I'm sure the accounts are permissions are good. It's funny but I have two test servers, SP1, that work and 3 prod servers ,SP2, that don't. I'll keep searching. Thanks again.

(in reply to ebgreen)
 
 
Post #: 9
 
 RE: Delete files script error with SP2 - 5/8/2008 6:49:27 AM   
  Rischip


Posts: 341
Score: 2
Joined: 3/26/2007
Status: online
Is it possible the file is open? Maybe someone has it open via a share on the other server?
Try using a brand new test file on the servers that don't appear to work and let us know the results. obviously the current logic of > 14 won't work, so you'll have to change that.

< Message edited by Rischip -- 5/8/2008 6:51:03 AM >


_____________________________

Rischip
Author of - The Grim Linker

(in reply to dukekern)
 
 
Post #: 10
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Delete files script error with SP2 Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts