|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
First, we'll use the FOR command to create a text file FOR /f %x in ("~*.*,*.bak,*.tmp,*.dmp") do @DIR E:\Files\%x /s /b >>deleteme.txt In parentheses and quotes, add all the file extensions you want to find separated by commas. Change the DIR path accordingly. This command will recurse from this directory and record the full path of every file found in the deleteme.txt file. The command will append to deleteme.txt if it already exists, so delete the file before running the command again or use a different file name. When the command finishes, review deleteme.txt to make sure there's nothing you want to keep. Edit the file as needed. To delete all the files, simply run: FOR /f "tokens=*" %x in (deleteme.txt) do @DEL "%x" In no time at all you've have your server cleaned up and you'll be able to go out and play. I'll come back to these techniques in another column and exploit them
further. Jeffery Hicks, MCSE, MCSA, is a Microsoft PowerShell MVP and scripting guru for SAPIEN Technologies. Jeff is a 16 year IT veteran who has co-authored and written several books, courseware and training videos on administrative scripting and automation. He is the co-author of Advanced VBScript for Microsoft Windows Administrators (Microsoft Press) and Windows PowerShell:TFM (SAPIEN Press). His latest is WSH and VBSCript Core:TFM (SAPIEN Press). You can contact Jeffery about "Clean Up Your Room" at jhicks@sapien.com. |
|||||||||||||||||||||||||||||||||||||||||||||||||
More Columns Command Performance December 2008 A Tasty Dish of Worms and Spam December 2008 Lessons in Logic December 2008 Internet Impeded by ISA Server Firewall December 2008 Clustering and Rolling Upgrades (Exam 70-642) December 2008 A Fix for Database Orphans December 2008 The Great Recession? December 2008 Bionic Scheduled Task Reporting December 2008 Backup (Almost) Made Easy December 2008 2009: The Year of Windows 7? December 2008
|
| ||||||||||||||||||||||||||||||||||||
| Home | Subscribe/Renew | About Us | Contributors | Tech Library | Tech Library Webcasts | RSS Feeds Issue Archive | Blogs | Certification/Careers | Chats | Columns | Now Online | Exam Guide | Events | Features | Forums MCP Radio | News | Poll | Tech Portals | Press Releases | Reviews | Salary Surveys | Search | Site Map | ||
| For more information, e-mail editor@mcpmag.com. | ||
| Application Development Trends | Campus Technology | CertCities.com | The Data Warehousing Institute ! E-Gov | EduHound ENTmag.com | Enterprise Systems | Federal Computer Week | Government Health IT | IT Compliance Institute MCPmag.com | Recharger | Redmond Developer News | Redmond | Redmond Channel Partner | Redmond Report TCPmag.com | T.H.E. Journal | TechMentor Conferences | Virtualization Review | Visual Studio Magazine | VSLive! Copyright 1996-2008 1105 Media, Inc. See our Privacy Policy. | ||
| . |