protected void createExportBackupFolders(
        File staticExport,
        String exportPath,
        int exportBackups,
        String ruleBackupExtension) {

        if (staticExport.exists()) {
            String backupFolderName = exportPath.substring(0, exportPath.lastIndexOf(File.separator) + 1);
            if (ruleBackupExtension != null) {
                backupFolderName = backupFolderName + EXPORT_BACKUP_FOLDER_NAME + ruleBackupExtension;
            } else {
                backupFolderName = backupFolderName + EXPORT_BACKUP_FOLDER_NAME;
            }
            for (int i = exportBackups; i > 0; i--) {
                File staticExportBackupOld = new File(backupFolderName + new Integer(i).toString());
                if (staticExportBackupOld.exists()) {
                    if ((i + 1) > exportBackups) {
                        // delete folder if it is the last backup folder
                        CmsFileUtil.purgeDirectory(staticExportBackupOld);
                    } else {
                        // set backup folder to the next backup folder name
                        staticExportBackupOld.renameTo(new File(backupFolderName + new Integer(i + 1).toString()));
                    }
                }
                // old export folder rename to first backup folder
                if (i == 1) {
                    staticExport.renameTo(staticExportBackupOld);
                }
            }

            // if no backups will be stored the old export folder has to be deleted
            if (exportBackups == 0) {
                CmsFileUtil.purgeDirectory(staticExport);
            }
        }
    }
protected void createExportBackupFolders ( File staticExport , String exportPath , int exportBackups , String ruleBackupExtension ) { if ( staticExport . exists ( ) ) { String backupFolderName = exportPath . substring ( 0 , exportPath . lastIndexOf ( File . separator ) + 1 ) ; if ( ruleBackupExtension != null ) { backupFolderName = backupFolderName + EXPORT_BACKUP_FOLDER_NAME + ruleBackupExtension ; } else { backupFolderName = backupFolderName + EXPORT_BACKUP_FOLDER_NAME ; } for ( int i = exportBackups ; i > 0 ; i -- ) { File staticExportBackupOld = new File ( backupFolderName + new Integer ( i ) . toString ( ) ) ; if ( staticExportBackupOld . exists ( ) ) { if ( ( i + 1 ) > exportBackups ) { CmsFileUtil . purgeDirectory ( staticExportBackupOld ) ; } else { staticExportBackupOld . renameTo ( new File ( backupFolderName + new Integer ( i + 1 ) . toString ( ) ) ) ; } } if ( i == 1 ) { staticExport . renameTo ( staticExportBackupOld ) ; } } if ( exportBackups == 0 ) { CmsFileUtil . purgeDirectory ( staticExport ) ; } } }
Creates the backup folders for the given export folder and deletes the oldest if the maximum number is reached.<p>

@param staticExport folder for which a new backup folder has to be created
@param exportPath export path to create backup path out of it
@param exportBackups number of maximum
@param ruleBackupExtension extension for rule based backups