private void cleanOldRevisions(String siddhiAppName) {
        File targetDirectory = new File(folder + File.separator + siddhiAppName);
        File[] files = targetDirectory.listFiles();
        if (files != null) {
            while (files.length > numberOfRevisionsToSave) {
                String firstRevision = null;
                for (File file : files) {
                    String fileName = file.getName();
                    if (firstRevision == null || fileName.compareTo(firstRevision) < 0) {
                        firstRevision = fileName;
                    }
                }
                File fileToDelete = new File(targetDirectory + File.separator + firstRevision);
                if (fileToDelete.exists()) {
                    Boolean isDeleted = fileToDelete.delete();
                    if (!isDeleted) {
                        log.error("Error deleting old revision " + firstRevision);
                    }
                }
                files = targetDirectory.listFiles();
                if (files == null || files.length < 1) {
                    break;
                }
            }
        }
    }
Method to remove revisions that are older than the user specified amount

@param siddhiAppName is the name of the Siddhi Application whose old revisions to remove
modules/siddhi-core/src/main/java/io/siddhi/core/util/persistence/FileSystemPersistenceStore.java