help deleting files and folders/subfolders older than X number of days
I really need an application that deletes files and folders/subfolders older than X number of days. I have posted about this before and I received responses leading me to scripts that don't appear to work the way I am describing here.
I need the script to just delete the files and not care about extensions or require any input by myself. I just need it to identify files who's created date is older than X number of days....and delete them automatically.
March 2nd, 2011 11:44am
I think it will be better to post your problem in "The Official Scripting Guys Forum!".
This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.
Microsoft Student Partner
Microsoft Certified Professional
Microsoft Certified Systems Administrator: Security
Microsoft Certified Systems Engineer: Security
Microsoft Certified Technology Specialist: Windows Server 2008 Active Directory, Configuration
Microsoft Certified Technology Specialist: Windows Server 2008 Network Infrastructure, Configuration
Free Windows Admin Tool Kit Click here and download it now
March 2nd, 2011 12:26pm
hi Frank
You can try the following
http://www.whoismadhur.com/2008/12/15/delete-old-files-with-auto-delete/
or my personal favourite
http://www.robobasket.com/
though i would advise deleting old files after having backed them up.. you never know who might need the file urgently after a few months or years have passed :)tech-nique
March 2nd, 2011 12:40pm
I see you are interesting in Windows PowerShell
$DateToDelete = 30
$StartFolder = "c:\test"
dir $StartFolder -Recurse -Force -ea 0 | ?{!$_.PsIsContainer -and $_.LastWriteTime -lt (Get-Date).AddDays(-$DateToDelete)} | del -Force
Just change "30" to a desired value. Accordingly change C:\test to target folder to process. Note this script removes only files. Folders are not touched.http://en-us.sysadmins.lv
Free Windows Admin Tool Kit Click here and download it now
March 2nd, 2011 12:42pm
To get a report you can use FSRM - Storage Reports Mnagement. But for deleting you will need a script like provided above.Shaon Shan |TechNet Subscriber Support in forum |If you have any feedback on our support, please contact tngfb@microsoft.com
March 8th, 2011 10:03pm