Help me Delete, like I've never deleted before...
August 2, 2011 11:50 AM   Subscribe

Need help from Sys Admins. You've never steered me wrong here... :) Need to know how to automatically have old data be deleted from Windows Server 2008, as well as have certain file types be automatically killed....Please see explanation...

I am but a lowly desktop support guy who's been asked to help out with this. Have several servers that backups are taking too long. The powers that be, have decided that they will NOT upgrade to larger capacity drives and backup tapes. Instead they've given me permission to delete ALL data older than a certain amount of months. Also, to delete indiscriminately certains types of data (mp3's, etc). I don't have too much scripting knowledge, so a simple tool or explanation of how this could be done would be very helpful. Of course if it's free, even better. Thank you all in advance
posted by stevyb to Technology (10 answers total) 3 users marked this as a favorite
 
I like Windows Search for investigating. Open Windows Explorer, select Search, enter *.mp3

You cannot, however, just delete all files older than X. Some of the drivers you're using have datestamps from years ago, as do some Windows operating system files. But you can certainly go into the folders that users have used as storehouses and do it.

But maybe you don't know which folders are the worst storehouses. For that, I like to use WinDirStat (get it from download.com) and let it show me folder size and usage statistics, and I also like SequoiaView which will give you a visualization - very cool for finding HUGE files, huge folders, and preponderances of file types you can kill (I just nuked 4GB of mp3s off one of our servers after finding them with SequoiaView).

The thing is, you don't want to script this. You don't want to do any of it blind. You sit down and look and think. You notice most of the MP3s are in one folder and delete it. You find a huge old dump or log file on the root of C that's 5 years old and either nuke it or zip it and stick it on a CD or flash drive. You figure out the users have gigs and gigs of old Excel files spread out over 15 folders and you can use Windows Search to find and can them. Caution is your key here.
posted by Lyn Never at 12:06 PM on August 2, 2011 [2 favorites]


delete the files, or just NOT back them up ?

That's a huge difference.

Unless you're running dumb "copy everything" backups, or a dinosaur-old back up program, once you've got a baseline of a backup, anything unchanged (read "old") should no longer be backed up.

Similarly, most backup programs should have an "exclude these file types from backup" setting (might be under an advanced or expert menu).

So, I may not be directly answering the question you asked, but hope I'm answering the question to mean ..

(If you really want to delete types or by dates, just use windows search and set your criteria accordingly, assuming search/index is enabled for your servers)
posted by k5.user at 12:09 PM on August 2, 2011


There is a command-line tool forfiles that's fairly powerful and can be used to hunt down and destroy old files.
For instance:
forfiles -p "C:\Logs" -s -m *.log -d -5 -c "cmd /c del @PATH"
Will find any *.txt files in C:\Logs older than 5 days and delete them.
Don't just copy this - understand it - scripting commands that can delete files is dangerous.
Information on forfiles is here and some examples of expiring files by date can be found here.
You can create a batch file using forfiles and call it on a regular basis with the Windows Scheduler. I've done this on our servers to clean out old log files.
posted by StickyC at 12:25 PM on August 2, 2011


2nding SequioaView, it's a very handy tool
posted by jcreigh at 12:52 PM on August 2, 2011


2nding ForFiles + batch job... I found some good instructions here: http://dotnetfish.blogspot.com/2008/04/managedelete-iis-log-files-using.html
posted by Gortuk at 1:14 PM on August 2, 2011


I've used (and like) TreeSize and WinDirStat, but I'll be checking out Sequoia - also agree with LynNever, don't script this. If it was something like clearing out old IIS logs, sure, but not specific hoarding by users.
posted by HopperFan at 1:29 PM on August 2, 2011


"backup tapes" - honestly, this is so outdated. Lots of companies are still utilizing them(tapes, tape libraries), but they should really be thinking about a better offsite solution.
posted by HopperFan at 1:54 PM on August 2, 2011


2TB drives cost less than a hundred bucks now. What are they paying you per hour?
posted by flabdablet at 4:22 PM on August 2, 2011


Like k5. stated I would just use the backup program to not back those files up. You could always go in and delete the files yourself. It will save you much grief. doing it any other way has a high probability that you might delete needed system files.
posted by majortom1981 at 4:55 AM on August 3, 2011


A quick chime in here. If you're planning on using SequoiaView, forget it and use SpaceMonger (there's a free version) instead. Way better. I use it all the time to scan certain servers when our Nagios cries out that they're approaching critical space availability.
posted by tra at 4:56 PM on August 3, 2011 [1 favorite]


« Older What kind of music is this? Is...   |  Hi, it's your friendly neighbo... Newer »
This thread is closed to new comments.