Last Updated March 25, 2003
BinManager is shell context menu command for deleting old items from Windows recycle bin, as well as a scriptable component for managing the recycle bin.
You can use either feature, or both.
This command enables you to empty all but the most recent items from your recycle bin. This is useful for several reasons:
- You're most likely to need to restore recently deleted items.
- For large drives, you may want to maintain smaller recycle bins than the minimum 1% permitted by Windows.
- Large recycle bins prolong the shutdown process.
The last two of these points were made by Developmentor's Ian Griffiths
on Chris Sells' wonderful Windows Technical Off Topic mailing list.
BinManager requires version 4.71+ of Windows shell.dll. If you're running a fairly recent version of Windows and/or Internet Explorer, you'll be fine.
The following JScript for Windows Scripting Host demonstrates the component's usage.
var bin = new ActiveXObject("BinManager.RecycleBin");
// Report the contents of the recycle bin.
WScript.Echo("Recycle Bin Holds\n" + bin.NumItems
+ " items\n" + bin.Size + " bytes\n");
// Permanently delete items recycled more than two days ago.
// Note, the argument is full calendar days, so specifying
// zero would delete all items older than today.
// Permanently delete all recycled items.
Note on Windows 2k Pro and XP Pro, you can use the Group Policy Editor to specify scripts to be run on logoff or shutdown. On XP Pro:
- Click Start, click Run, type gpedit.msc, and click OK.
- Specify the script under:
- Computer Configuration | Windows Settings for startup or shutdown, or
- User Configuration | Windows Settings for logon or logoff.
- Download and run setup.exe.
- Right-click the recycle bin to ensure the "Delete Items Older Than" command appears on the menu.
source.zip is a Microsoft Visual C++ .NET project with attributed ATL. There are no dependencies on the CLR or WTL.
March 21, 2003. Version 1.0.
March 24, 2003. Version 1.1.
- Worked around a bug in the Windows 2000 shell.
March 25, 2003. Version 1.2.
- Fixed a bug I introduced in 1.01, above. The bug caused the Size property to incorrectly return 0 bytes in all cases. Thanks and a tip o' the hat to Herb Warren for staying with it.
Copyright © 2003 by Tim Tabor. All rights reserved. No warrantees extended. Use at your own risk. You may use the source code without royalty. You may not distribute any portion of the source or binary without the express written consent of Tim Tabor.
Please report bugs and feature requests to me.