Loading
Scriptbox
 VBScript Links 
 About VBscript 
 JavaScript Links 
 About JavaScript 
 Powershell Links 
 PSCRIPT the Script Launcher 
 PowerShell Shortcut Keys 
 About Powershell 
     VBScript
    JavaScript
    Powershell
Disclaimer
Contact
Latest 10 Scripts
Script search
  :: { Category } :: 0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ
         

Search Options:  Delete  the  Oldest  File  From  a  Folder  If  and  When  That  Folder  Exceeds  a  Specified  Size  

 Content of Delete the Oldest File From a Folder If and When That Folder Exceeds a Specified Size.vbs
MD5 Hash: 896765C64E4A04D1492774C83F1C5615
strOldestFile = ""
dtmOldestDate = Now

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("C:\Scripts")

intFolderSize = Int((objFolder.Size / 1024) / 1024)

If intFolderSize >= 25 Then
Set colFiles = objFolder.Files

For Each objFile in colFiles
strFile = objFile.Path
dtmFileDate = objFile.DateCreated
If dtmFileDate < dtmOldestDate Then
dtmOldestDate = dtmFileDate
strOldestFile = strFile
End If
Next

objFSO.DeleteFile(strOldestFile)
End If



   © 2008 - 2013 Boris Toll      :: Scripts available: 6.481 ::      :: scriptbox.toll.at ::      :: powered by www.toll.at ::
  Google Entries:n/a
  Yahoo Backlinks:n/a
  Live Backlinks:n/a
  del.icio.us Bookmarks:n/a
  Technorati Links:n/a