const fldname = "c:\test"
set fso = createobject("scripting.filesystemobject")
set fldr = fso.getfolder(fldname)
set dttoday = date
set dt2monthsago = dateadd("m", -2, dttoday)
recurse fldr
sub recurse( byref fldr)
dim subfolders,files,folder,file
set subfolders = fldr.subfolders
set files = fldr.files
wscript.echo fldr.path
for each file in files
if file.datelastmodified < dt2monthsago then
wscript.echo "Deleting " & file.name & " last modified: " & file.datelastmodified
on error resume next
file.delete
end if
next
for each folder in subfolders
recurse folder
next
set subfolders = nothing
set files = nothing
end sub
Wednesday, June 8, 2005
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment