How to use the logtext utility: DeleteTempFolder.cmd
Navigation: Diese Seite in Deutsch - Main page - Contents - Logtext utility - DeleteTempFolder.cmd
| This page shows an example on how to use the logtext
utility.
If you follow the instructions below, they will give you an easy way to delete the contents of your TEMP directory (the folder Windows and applications store temporary files, but never delete them again automatically). If you are not interested in an example for logtext, but in the DeleteTempFolder script, then you should go to this page. |
| Of course we don't need logtext to delete
the files and folders. We only want to show a practical example on how
to keep track of the performed actions of a batch script in a proper log
file.
Some versions of Windows had (or still have) a command line utility DELTREE.EXE. This utility is at least not shipped with Windows 2000, so here is a batch file that does the same job. IF %TEMP%.==. GOTO :EOF
Create a folder called DeleteTempFolder in your program files directory. Then create a file called DeleteTempFolder.cmd in this folder (create a text file and rename it) or download DeleteTempFolderNoLog.cmd and save it in the newly created directory. Please note that you should set your desktop to show filename extensions. If you want to use the command line to create the directory and the file, follow these steps:
Download logtext.exe and put it either in DeleteTempFolder or - even better - in your Windows system32 directory (usually c:\winnt\system32). The benefit of having it in the same folder as the batch file itself provides you with an easy option to get rid of it again, if you want. On the other hand, once it is in your Windows directory, you can access it from and for any other batch file as well, without the need of copying it into every single folder you want to invoke it from. After logtext.exe is installed, we can wrap our little command line script by the final script. @ECHO OFF
Download DeleteTempFolder.cmd, if you don't want to create it yourself and put it in the same directory as the base deletion script DeleteTempFolderNoLog.cmd. In the above example the batch file will create a new log file every month, while previous files will be compressed. It will keep up to 12 compressed log files. If you want it to start a new log file every day, just replace MONTHLY by DAILY. Invoke DeleteTempFolder.cmd now and see what it does. It will delete the contents of your Windows folder that contains temporary files. A new file called DeleteTempFolderYYYY-MM.log will be created in the batch file's directory. It contains every single step DeleteTempFolderNoLog.cmd processed. If you create a shortcut to DeleteTempFolder.cmd on your desktop, you can run it conveniently any time you think it's time to empty Windows' temporary folder again. Please remember to never call DeleteTempFolderNoLog.cmd directly, because you wouldn't get a log file and therefore not be able to tell what files it had deleted |
Navigation: Diese
Seite in Deutsch - Main page - Contents
- Logtext utility -
DeleteTempFolder.cmd
---
All scripts (batch files) and programs provided by www.wabel.de.
Wagner Belmer GbR (WaBel)
(C) Thomas Belmer
ASAMnet - - PMView - Allee Parkhotel Maximilian - Autospenglerei Belmer - Email - Thomas's homepage - Bieruhr - Panoramas - Amberg live