Powered by Squarespace

« Speculations on the Future | Main | OSI Model.. Use it. »

Easy Script to Empty Your Users' Recycle Bin

To give a bit of a background to this story, I work at an NPO (Non Profit Org.) Therefore we don't have much budget for equipment, software, etc. So as our program explodes, (it is taking off and we are getting many new clients and facilitating many many many new people and this is happening very fast) therefore our records are of course taking up much more space, and because of that, we are having issues with backups. 

We also have 6 remote offices and use Citrix which is a virtual desktop software. This desktop for each usertakes up space on potentially 2 servers. We have one for the primary use, and another for load balancing. But the users of course have a desktop with a recycle bin, local storage, which are all on the servers. Many of our users are not the most tech savy and don't do things like deleting shortcuts and emptying the recyclebin. So some people have gigs of stuff in the recyclebin. 

My boss came up to me the other day and asked that I find a setting in Citrix, which is emulating wndows XP, to make it so that a user's recyclebin would empty on their logoff. I searched through the options presented for citrix but I didn't find a one to make that happen. So I started playing around in an XP VM and on an XP machine. 

Now, I at that point, had virtually no programming/ scripting/ coding experience, except in a java 1 class which was 7 years ago (I don't remember much) and the HTML (I know it is really a markup language not programming) classes I've taken. So I of course scoured the intertubes to find a script to do so. I found a few which actually didn't end up working due to some un recognized characters. I guess that there was something that programmers would know inherrintly that were not suposed to be there or were supposed to be substituted. I couldn't get to the bottom of what was wrong so I decided to do make my own simple, easy to understand tiny little script.

So for anyone who doesn't know, the location of the Recycle Bin in windows XP is at c:\recycler one does not see this typically, nor will toy see it when you select show hidden folders. To see this you need to disable "Hide protected operating system files" You can do this by going to windows explorer --> tools --> Folder options --> view and you will find the checkbox. 

So all it takes now is a simple batch script. 

@echo off
cd c:\recycler
rd c:\recycler



So that worked perfectly. Saving it on one of the servers and pointing the user to it through a startup script on the XP machine and an XP VM as . However it did not work on citrix because citrix runs its startup scripts then creates its mapping to the drives. So after fiddling with it for a while I decided to just create this as one of the start up programs for when a user logs onto windwos. So I placed the above saved as a .bat into the Start --> All Programs --> Startup

So there it is, an easy, simple straightforward script for anyone who wants to make the recyclebin empty as they or their users are logging on on XP. For windows 7 and vista replace c:\recycler with C:\$Recycle.Bin

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments (1)

Excellent post, learned quite a few new things. Keep up the good work.

September 29, 2011 | Unregistered CommenterJon Ferretti

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>