@echo off REM Sweepup.bat -- Try to prevent too much kipple from accumulating. REM See "Blade Runner: Do Androids Dream of Electric Sheep" REM by Phillip K. Dick for a discussion on kipple. REM Requires deltree.com (FreeDOS) or deltree.exe (MS DOS) REM You can get deltree.com from the FREEDOS (http://www.freedos.org) Project! REM http://www.highfiber.com/~raster/deltree.zip REM Neither are LFN (Long File Name) aware!!! REM Also needs "timeout.exe" REM http://am.net/lib/TOOLS/AM/TIMEOUT.EXE REM You may want to check out the following (hacker site!) rem http://www.astalavista.com/library/os/win95-98/mshidden.txt rem Microsoft's Really Hidden Files: A New Look At Forensics (v2.6) rem By The Riddler (November 3, 2001) REM v1.0 02-Mar-1998 JPV REM v1.1 15-Mar-1998 JPV added IE cookies, xdel stuff REM v1.2 22-Oct-1998 JPV added Machine Name Stuff REM v1.3 27-Oct-1998 JPV Added Deltree c:\windows\temp, md c:\windows\temp REM v1.4 16-Dec-1998 JPV Added c:\windows\recent, some comments REM v1.5 19-Jan-1999 JPV Removed cookies code REM v1.6 27-Jan-1999 JPV Added IE4 folder.htt and desktop.ini bullshit REM v1.7 06-Feb-1999 JPV Added move scandisk REM v1.8 28-Dec-1999 JPV Added nukeing some IE stuff REM v1.9 04-Jan-2000 JPV Added nukeing some Netscape stuff REM v1.91 08-Jan-2000 JPV Netscape dir LFN bug fix REM v1.10 03-Jan-2001 JPV Added rd "\1Files\My Pictures"\ REM v2.0 19-Jul-2001 JPV Updated for Win2K and re-org'ed, added notes. REM v2.1 19-Aug-2001 JPV Updated for "My Pictures" & "My eBooks". REM v2.2 21-Aug-2001 JPV Changed deltree to rd for MMSBS, added c:\MyImag~1 REM v2.3 10-Dec-2001 JPV Added timeout.exe (warning re: installing programs) REM & added reference to "mshidden.txt" above. REM v2.4 11-Dec-2001 JPV Added MS Backup "Exclude Files" list REM NOTES: rem 1. You need to change the Netscape path below, or REM it if you don't rem use NS. rem 2. deltree /y \path\ with the trailing "\" will delete sub-dirs rem but NOT the listed dir. I.E. "deltree /y c:\temp1\" will delete rem anything inside c:\temp1, but not temp1 itself. rem "deltree /y c:\temp1" will delete c:\temp1 and anything in it. rem 3. You can't do deltree "\path\" because deltree is too really LFN aware rem and thus not able to figure out quotes. You can use paths or %vars% rem if they do not have spaces or LFNs in them. So you have to "cd" in rem first... rem 4. Place a shortcut for this in your startup group. That way it runs rem before most apps have started and is thus more likly to clean up rem crap and NOT affect any program. rem 5. If you want to log what it's doing, change your shortcut to something rem like this: "{Path}\Sweepup.bat > 2>&1 {Path}\Sweepup.log" rem The "2>&1" redirects STDERR to the same place as STDOUT to catch rem error messages too. rem 5a. You could also use the task scheduler to schedule it, but that's rem probably a BAD idea, since you could collide with open files in your rem data (e.g. Word temp files that you might still need). rem 6. For the most part, you can't delete files that are in use or that you rem do not have permissions on. This is one reason to run in startup rem before anything else is running. It also makes it harder to delele rem important system files. You DATA files are a different story, since rem they are only in use when you are USING them (what a concept). rem Anyway, deltree will report that it deleted a file that it tries to rem delete, even when it in fact fails! It could fail for lack of rem permissions or because the file is actually in use. The point is rem that it REPORTS that it deleted the file. Thus, you might want to rem check up on it now and then and make sure it's ACTUALLY deleteing rem what you want... rem 7. Of course, deleted files are not really GONE. Various ways exist to rem get them back. You need to use EFS and wipe space to really protect rem data, and that is WAY out of the scope of this batch file. It really rem exists just to make sure that crap does not build up *too* much. REM ====================================================================== REM Presumably, if the MS Backup utility specifically does not back these REM files, you probably don't needs to care about them a whole lot... REM I don't delete them below--this list is just for reference. rem Windows 2000 Pro MS Backup "Exclude Files" List rem File Description rem ----------------------------------------------------------- rem \*.crmlog ComPlus (in XP "Microsoft Writer (Bootable State)") rem \hiberfil.sys Power Management rem \Pagefile.sys Memory Page File rem C:\Documents and Settings\Administrator\index.dat\ Internet Explorer rem C:\Documents and Settings\Administrator\Local Settings\Temp\* Temporary Files rem C:\WINNT\CSC\* Client Side Cache rem C:\WINNT\Debug\* Winlogon debug rem C:\WINNT\netlogon.chg Netlogon rem C:\WINNT\Registration\*.clb ComPlus (in XP "Microsoft Writer (Bootable State)") rem C:\WINNT\schedlgu.txt Task Scheduler rem C:\WINNT\System32\DTCLog\MSDTC.LOG MS Distributed Transaction Coordinator rem In addition to the above, Windows XP Pro MS Backup adds rem File Description rem ----------------------------------------------------------- rem \System Volume Information\*{3808876B-C176-4e48-B7AE-04046E6CC752} VSS Default Provider rem \System Volume Information\_restore{7F00C821-72E1-40D9-BE7F-7B5F56145BE1}\* System Restore rem C:\Documents and Settings\All Users\DRM\* DRM rem C:\WINDOWS\csc\* Client Side Cache rem C:\WINDOWS\repair\asr.err ASR Error File rem C:\WINDOWS\repair\asr.log ASR Error File rem C:\WINDOWS\system32\CatRoot2\* Catalog Database rem C:\WINDOWS\System32\MSDtc\MSDTC.LOG MS Distributed Transaction Coordinator rem C:\WINDOWS\System32\MSDtc\trace\dtctrace.log MS Distributed Transaction Coordinator rem C:\WINDOWS\system32\NtmsData\* MS Writer (Service State) REM ====================================================================== REM Startup echo. echo. echo WARNING: you probably want to cancel this (use CTRL-C) if you just echo installed a new program. Some installers put files in TEMP directories, echo which they then need after you reboot. echo. echo Press CTRL-C now, then answer "Y" to cancel... echo. timeout 15 REM ====================================================================== REM Common or OS independant REM Get to the correct place, since deltree is too stupid to be able to REM handle quotes -- needed for dirs with spaces in the names... REM You'll have to change "default" to your NS profile name. c: cd "\Program Files\Netscape\Users\default\" REM Remove Netscape Cache and cookies. Deleteing cookies is probably a REM good thing, but you may lose some web site settings! deltree /y Cache\ if exist cookies.txt del cookies.txt REM Remove useless ScanDisk.log if exist c:\scandisk.log del c:\scandisk.log REM Remove Moronic MS Bullshit (MMSBS) rem RESEARCH if exist C:\AutoDiscovery rd C:\AutoDiscovery if exist C:\MyMusi~1 rd C:\MyMusi~1 if exist C:\MyImag~1 rd C:\MyImag~1 rem RESEARCH if exist C:\1Files\MyPict~1 rd C:\1Files\MyPict~1 rem if exist C:\1Files\MyeBoo~1 rd C:\1Files\MyeBoo~1 if exist C:\1Files\MyMusi~1 rd C:\1Files\MyMusi~1 REM Other junk that you can usually nuke ANYWHERE you find it. REM Temp files rem del /f /q /s c:\~*.* rem del /f /q /s c:\*.tmp rem del /f /q /s c:\$ms*.* REM Some backup programs do not backup empty folders, so some apps create REM this placeholder to the folder is not empty. Space waster... rem del /f /q /s c:\mscreate.dir REM This is all crap associated with the "Web" view for folders. rem del /f /q /s c:\folder.htt rem del /f /q /s c:\desktop.ini REM Lotus Notes crash/debug file created all over your disk when Notes crashes. rem del /f /q /s c:\*.rip REM ====================================================================== REM NT/Win2K REM E.g. %USERPROFILE% = C:\Documents and Settings\jvossen REM If this fails, we're probably NOT running NT or 2K if "%USERPROFILE%" == "" goto Win9x REM Get to the correct place, since deltree is too stupid to be able to REM handle quotes -- needed for dirs with spaces in the names... c: cd "%USERPROFILE%\Local Settings\" REM Temp files deltree /y Temp\ REM Don't do this -- use the IE setting under the Advanced tab: REM "Empty Temporary Internet File Folder when Browser is closed" REM deltree /y "%USERPROFILE%\Local Settings\Temporary Internet Files\" REM This will nuke your cookies, which is probably a good thing, but REM you may lose some web site settings! cd .. deltree /y Cookies\ REM Remove "Recently" accessed documents list (not the docs themselves!) deltree /y Recent\ REM Ditto, for Office cd "Application Data\Microsoft\Office\" deltree /y Recent\ REM Yes, Win2K still has \winnt\temp... deltree /y %SystemRoot%\Temp\ cd \ REM This is stuff probably don't want to delete, but you might want to REM know where it is some day. REM IE bookmarks or favorites rem "%USERPROFILE%\Favorites\" REM Outlook data (address books, messages stores) rem "%USERPROFILE%\Local Settings\Application Data\Microsoft\Outlook" rem "%USERPROFILE%\Application Data\Microsoft\Outlook" goto EOF REM ====================================================================== REM Win9x :Win9x REM Clean up Temp dir(s) deltree /y c:\windows\temp\ deltree /y c:\windows\tempor~1\ REM Nuke Win9x "Documents" on Start Menu deltree /y c:\windows\recent\ REM Nuke IE Cookies & History deltree /y c:\windows\cookies\ deltree /y c:\windows\history\ :EOF