(view source code of deltrash2.kix as plain text)
; DelTrash2.kix, Version 1.00
; Empty the Recycle Bin, or remove only files older than the specified number of days
;
; Usage: KIX32 DELTRASH2.KIX [ /A:days ] [ /Q ]
;
; Where: days is the minimum age in full calendar days of files to be deleted
; (0 means delete everything older than today)
; /Q suppresses screen output (number of items and MBs)
;
; Notes: [1] This script requires BinManager by Tim Tabor
; http://www.cheztabor.com/BinManager/
; [2] This script was based on Tim Tabor's own JScript sample
;
; Written by Rob van der Woude
; http://www.robvanderwoude.com
$rc = SetOption( "Explicit", "ON" )
Dim $arrAge[1], $arrArgs[], $blnQuiet, $intAge, $intItems, $intSize, $objBin, $strArg, $strMsg
; Get BinManager object
$objBin = CreateObject( "BinManager.RecycleBin" )
$intItems = $objBin.NumItems
$intSize = $objBin.Size
$arrArgs = GetCommandLine(1)
$blnQuiet = 0
$intAge = -1
For Each $strArg In $arrArgs
If UCase( $strArg ) = "/Q"
$blnQuiet = 1
EndIf
If InStr( UCase( $strArg ), "/A:" )
$arrAge = Split( $strArg, ":" )
$intAge = CInt( $arrAge[1] )
EndIf
Next
If $intAge = -1
$rc = $objBin.Empty( )
Else
$rc = $objBin.DeleteOldItems( $intAge )
EndIf
If $blnQuiet = 0
? $intItems - $objBin.NumItems
" items were removed from the Recycle Bin ("
FormatNumber( ( ( $intSize - $objBin.Size ) / 1048576 ), 1, -1, 0, 0 )
" MB)@CRLF"
$intSize = FormatNumber( ( $objBin.Size / 1048576 ), 1, -1, 0, 0 )
"The Recycle Bin still holds " + $objBin.NumItems
" items (" + $intSize + " MB)@CRLF"
EndIf
Exit
page last modified: 2024-04-16; loaded in 0.0075 seconds