Clearing tempororary files
Being a laptop user, disk space can be an issue and temporary files can be one of the things to clear out to free up some space. There are freeware applications that enable you do do this, but you can just use what is built into Windows to do the same thing. It is run from the command line and is the command rd
or rmdir
, which basically means 'remove directory'. It can be used to remove directories as well as its sub directories and files, by just typing rd C:\MyFolder\ /s /q
(the /s switch is to include sub directories and /q prevents the prompt to remove a directory tree).
At first, I thought that running it on the temporary folders directory would remove it and somehow break windows, but it doesn't. This is because there are files within that directory that are in use, and as a result, it can't be deleted. However, all the files and sub directories that aren't locked are removed, freeing up space. I use a simple batch file that cleans up the temporary folders, which can be set to run as a scheduled task (assuming you have the computer on at the time).
cleanup.cmd
@echo off rem clean up windows temp directory rd C:\Windows\Temp\ /s /q rem clean up users temp directory rd %temp% /s /q
The advantage of doing it in a batch file is that you can easily add any directories that also have temporary files, for instance, to clean up you Internet Explorer temporary files add in rd "%homepath%\Local Settings\Temporary Internet Files\" /s /q
(assuming you haven't moved the location of the temporary internet files folder).
You can also use the Disk Cleanup tool that is built into Windows: Right Click desired drive in 'My Computer', select 'Properties', then click the 'Disk Cleanup' button. This also compresses files that you don't access often, but takes some time.
Comments