Skip to main content

prune_backups

Function prune_backups 

Source
pub fn prune_backups(
    source: &Path,
    backup_dir: &Path,
    history_size: u32,
) -> Result<()>
Expand description

Remove old backups for source that exceed history_size.

Backups are identified by the {stem}_*.bak glob pattern in backup_dir and sorted newest-first by filename (which embeds the timestamp). The newest history_size backups are kept; the rest are deleted.