Alternative Title: How to recursively delete sub-folders of a given name (and their contents) from the Windows command line.
ImageGen, the popular image resizing and manipulation component for Umbraco creates a folder called 'Cached' in each media item's folder. This contains an XML file detailing the contents of the cache, along with the cached images themselves.
Sometimes, it's handy to clear these cached folders (when transferring a large site from one server to another, for example), but there's no automatic way of doing this.
So - reach for your favourite text editor, create a file called 'clearcache.bat' (or similar) in the root of your 'Media' folder and enter the following:
for /f "tokens=* delims=" %%i in ('dir /s /b /a:d Cached') do (rd /s /q "%%i")
Save this batch file and execute it to remove all of your 'Cached' folders.
Note that this doesn't ask for any sort of confirmation and will blindly delete everything in a folder called 'Cached'. So - make sure you start it from the correct folder!