asp.net consultancy chorley ASP.NET Server Side Scripting Wigan
Website Development Radcliffe

IT Services And Support

Email : ren@techsolus.co.uk
Mobile Phone : 0788 68 41 411
Answerphone : 01204 469683
bespoke invoice systems Standish Information Technology Advice Worsley
    development systems Ramsbottom
data manipulation Farnworth access databases Whitefield SQL connections Atherton
online accessible software Leyland software compatible Coppull


Get connected and Online Tottington
remote management Makerfield code and design Aspull

VB Script to Delete Files Older Than X Minutes - 11/04/2012

Sometimes the seemingly complex need not be so...

Use this in a .vbs file to delete files over a certain creation date and time.

dim myfso
set myfso = createobject("Scripting.FileSystemObject")

dim mydir
set mydir = myfso.getfolder("C:\myfolder\myworkingfolder\")                 

dim myfiles
set myfiles = mydir.files

dim mymod

for each mymod in myfiles
 if datediff("n", mymod.datecreated, now) > 65 then mymod.delete        .
next

2 things to note...change the folder to the folder youw ant to work on and the "65" is the number of minutes od the file is before it's deleted.

No need for explanation really...

Post A Comment

Name Comment
programming services asp.net specialist
Valid XHTML 1.0 Transitional
Admin
GD