Skip to main content

Module backup

Module backup 

Source
Expand description

Backup creation under $DOTFILES/.yui/backup/.

Path scheme: mirror the absolute target path (drive colon stripped on Windows), then suffix the basename with a timestamp before the extension.

  target  C:\Users\u\.config\foo\bar.yml
  backup  $DOTFILES/.yui/backup/C/Users/u/.config/foo/bar_20260429_143022123.yml

Functions§

backup_dir
Recursively copy src (a directory tree) to dest. Symlinks within the tree are skipped (we’d be copying their targets again redundantly, and link semantics don’t carry meaning in a backup).
backup_file
Copy src (a regular file) to dest, creating parent dirs as needed.
backup_path
current_timestamp
Format the current local time using a jiff strtime pattern.