May was a big month for new releases from Linux Academy! Take a look at what our team built recently in our blog. You can access the newest releases from our blog.
Const adVarChar = 200 Const adDate = 7 ipreserve=1 '# of files to preserve sfolderpath="d:\temp" 'your path to the folder set fso=createobject("scripting.filesystemobject") if not fso.folderexists(sfolderpath) then set fso=nothing wscript.echo "The folder does not exist." & vbcrlf & sfolderpath & vbcrlf & "Operation aborted." wscript.quit end if set ofolder=fso.getfolder(sfolderpath) set rs = createobject("ador.recordset") with rs.fields .append "filepath",adVarChar,255 .append "datelastmodified",adDate end with with rs .open for each ofile in ofolder.files .addnew array("filepath","datelastmodified"), array(ofile.path,ofile.datelastmodified) .update next end with icount=0 if not (rs.eof and rs.bof) then rs.sort="datelastmodified desc" rs.movefirst do while not rs.eof icount=icount+1 if icount>ipreserve then on error resume next fso.deletefile rs.fields("filepath"),true on error goto 0 end if rs.movenext loop end if set rs=nothing set ofolder=nothing set fso=nothing
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.