To get this train rolling, first we have to create our virtual junk drawer. Then we have to configure our janitor to clean out the files older than a number of days you determine. Finally, we'll schedule the janitor to clean up at...
See more »
To get this train rolling, first we have to create our virtual junk drawer. Then we have to configure our janitor to clean out the files older than a number of days you determine. Finally, we'll schedule the janitor to clean up at a regular, convenient time. Let's get started. * Create a directory in your main documents directory which is going to serve as a holding pen for temporary, disposable files. You hard core folks can call it temp. Mine is in C:\Gina\junkdrawer\, so that's how I'll refer to it for the rest of this article. * Set your web browser and e-mail client to save downloaded files and message attachments in your junkdrawer. Firefox users, in the Tools menu, Options, click on Downloads. Set the directory Firefox should download to automatically there, like so. (Click to enlarge.) * Right-click on this Janitor.vbs script. Save it in your documents. Mine is located in C:\Gina\scripts\Janitor.vbs. Note: Because my VB script skills are small and weak, the most excellent and generous Lifehacker reader Brian Plexico lent his scripting-fu and put this bad boy together. Brian - Lifehacker readers, my C: drive and I all thank you. * Using a plain text editor like NotePad or EditPlus, open up the Janitor.vbs file. Edit the following sections to set the path to your junk drawer directory, and how many days old files should be when they get deleted. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 'ENTER THE PATH THAT CONTAINS THE FILES YOU WANT TO CLEAN UP '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 'Path to the root directory that you're cleaning up PathToClean = "C:\Gina\junkdrawer" '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 'ENTER THE NUMBER OF DAYS SINCE THE FILE WAS LAST MODIFIED ' 'ANY FILE WITH A DATE LAST MODIFIED THAT IS GREATER OR EQUAL TO 'THIS NUMBER WILL BE DELETED. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 'Specify the how many days old a file must be in order to be deleted. numberOfDays = 7 '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ So you'll see above, in the line that begins PathToClean, replace C:\Gina\junkdrawer with the path to your junk drawer. Also, change the line numberOfDays to your preferred time frame. I'm good with deleting stuff 7 days old, but you might want to start with a month (30) or two weeks (14.) Next we're going to test the script, but before we go there, for the love of all that is holy, read this first. Don't make me use the blink tag.
See less »
Kaboodle will send you a newsletter and updates from your friends. You can unsubscribe at any time. Kaboodle does not sell or share your email address or personal information with anyone.
Kaboodle requires all users to provide their real date of birth as both a safety precaution and as a means
of preserving the integrity of the site. You will be able to hide this information from your profile if you wish.
Added by 1 people