@Nullable
    private List<ContentStorage.FileInformation> getDirsToRemove(final int maxBackupNumber, final boolean autobackup) {
        final ArrayList<ContentStorage.FileInformation> dirs = getExistingBackupFoldersSorted(autobackup);

        if (dirs == null || dirs.size() <= maxBackupNumber || maxBackupNumber >= activityContext.getResources().getInteger(R.integer.backup_history_length_max)) {
            Log.i("no old backups to remove");
            return null;
        }
        Log.w("old backups to remove: " + dirs);
        return dirs.subList(0, dirs.size() - maxBackupNumber);
    }
Private methods containing the real backup process
main/src/main/java/cgeo/geocaching/utils/BackupUtils.java