Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

script that deletes files older than 5 days

This is a discussion on script that deletes files older than 5 days within the VB.NET forums, part of the Software Development category; Hi, this may sound weird, but to some release problems with our sql server 2k i have to remove the transaction logs manually. In order for me to avoid this ...

Go Back   Geeks Talk > Software Development > VB.NET
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read

VB.NET Visualbasic.NET

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-08-2009
Junior Member
 
Join Date: Jul 2009
Location: nyc
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
krystian is on a distinguished road
script that deletes files older than 5 days

Hi, this may sound weird, but to some release problems with our sql server 2k i have to remove the transaction logs manually. In order for me to avoid this time consuming task i have written [or rather modified] the simple script that does it for me. My issue however is that, while i'm trying to schedule it as a job [on sql server], i'm getting a message that the script has created objects that are not being deleted [weird] should i remove the fso object at the end of my script? here is the code:
Code:
 option explicit  dim fso, dtwoweeksago dtwoweeksago = date() - 5 set fso = createobject("scripting.filesystemobject") dirwalk("g:\weekly tran\") dirwalk("g:\daily tran\") sub dirwalk(parmpath) dim osubdir, osubfolder, ofile, n on error resume next set osubfolder = fso.getfolder(parmpath) for each ofile in osubfolder.files if err.number <> 0 then err.clear elseif ofile.datelastmodified < dtwoweeksago then fso.deletefile ofile.path, true end if next for each osubdir in osubfolder.subfolders dirwalk osubdir.path next on error goto 0 end sub
Reply With Quote
Sponsored Links
Reply

  Geeks Talk > Software Development > VB.NET

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Loadrunner script with attachment files sai1234 LoadRunner 6 02-04-2009 03:28 PM
Showing older Java version Geek_Guest Unix/Linux 0 09-09-2007 09:30 AM
how many days apart? vmshenoy Brainteasers 3 01-17-2007 02:58 AM
How many 4Test Script files should be present in the Suit file S1. JobHelper SilkTest 0 12-28-2006 06:03 AM
Howmany days.. psuresh1982 Brainteasers 4 11-29-2006 01:52 AM


All times are GMT -4. The time now is 03:29 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved