Java tutorial
//package com.java2s; //License from project: Apache License import java.io.File; public class Main { static int imageNumber = 0; public static void fileDelete(File cacheDir) { if (imageNumber < 30) return; File storage = cacheDir; String fileName = "temp" + imageNumber + ".jpg"; File tempFile = new File(storage, fileName); if (tempFile.exists()) { tempFile.delete(); } } }