Alternative to recursive file deletion in directories?
<pre><code>//Check that external storage is mounted and accessable
    String accessable = Environment.getExternalStorageState();
    if (!Environment.MEDIA_MOUNTED.equals(accessable)) {
        buildWarningMessage();
    }

//Set the cache directory
        CACHE_DIRECTORY = externalRoot + "/folder/.cache/";



@Override
    protected void onDestroy() {
        super.onDestroy();
        File cacheFile = new File(CACHE_DIRECTORY);
        if (cacheFile.exists()) {
            deleteDir(cacheFile);
        }
</code></pre>

<p>I'm currently using the above code to create a folder which is used to temporarily store images that the app uses later. deleteDir is just a generic recursive file deletion to empty a directory. Is there a better way to do this than to delete everything? Ideally I just want a temp folder that empties when the application closes.</p>
