Skip to content

Backup Juggler

Backup Juggler is a command-line tool that allows you to perform multiple copies of files and directories simultaneously. The whole application is based on a command called bj. This command has a subcommand related to each action that the application can perform. Like do-backups and get-size.

System requirements

Backup Juggler requires Python 3.11+ (it was developed with Python 3.11, so we do not guarantee it will work with earlier versions). It is cross-platform and the goal is to make it work equally well on Linux, macOS and Windows.

How to install?

To install the Backup Juggler CLI, we recommend that you use pipx. It installs Python CLI applications globally while still isolating them in virtual environments, managing upgrades and uninstalls.

  1. Install Backup Juggler:
    pipx install backup-juggler
    
  2. Update Backup Juggler:
    pipx upgrade backup-juggler
    
  3. Uninstall Backup Juggler:
    pipx uninstall backup-juggler
    

Although this is just a recommendation! You can also install the project with the manager of your choice.

How to use?

Using do-backups

You can call do-backups via command line. For example:

bj do-backups --source <source_path> --destination <destination_directory>
  • --source or -s option specifies the source path(s) to be backed up;
  • --destination or -d option specifies the destination directory(s) for the backups.

The sources can be individual files, where the copy will be saved in a newly created directory inside the target directory, using the same name as the file; or entire directories, where the entire source directory will be copied recursively to the target directory.

About the sources

The FileNotFoundError exception will be raised if the paths specified as sources do not exist, so make sure you enter the paths correctly.

Making multiple backups

Both options can be called multiple times, allowing the specification of multiple source paths and multiple destination directories for the backups.

  1. Single source to multiple destinations
    bj do-backups --source '/path/to/source' --destination '/path/to/destination1' --destination '/path/to/destination2'
    
  2. Multiple sources to a single destination
    bj do-backups --source '/path/to/source1' --source '/path/to/source2' --destination '/path/to/destination'
    
  3. Multiple sources to multiple destinations
    bj do-backups --source '/path/to/source1' --source '/path/to/source2' --destination '/path/to/destination1' --destination '/path/to/destination2'
    

Using get-size

You can call get-size via command line. For example:

bj get-size --source <source_path>
  • --source or -s option specifies the source path(s) that will have their total sizes calculated.

To calculate the total size of the specified source(s), which can be individual files or entire directories, where the calculation will be done recursively

About the sources

The FileNotFoundError exception will be raised if the paths specified as sources do not exist, so make sure you enter the paths correctly.

Calculating from multiple sources

The --source of -s option can be called multiple times, allowing the specification of multiple source paths to return the sum of their total sizes

bj get-size --source /path/to/source1 --source /path/to/source2

More information about the CLI

The information about the command-line tool can be accessed using the --help flag:

bj --help

or just

bj
 Usage: bj [OPTIONS] COMMAND [ARGS]...

 Multiple copies of files and directories simultaneously made easy.

╭─ Options ──────────────────────────────────────────────────────────────────────────────────╮
│ --version             -v        Shows the version of the Backup Juggler.                   │
│ --install-completion            Install completion for the current shell.                  │
│ --show-completion               Show completion for the current shell, to copy it or       │
│                                 customize the installation.                                │
│ --help                          Show this message and exit.                                │
╰────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ─────────────────────────────────────────────────────────────────────────────────╮
│ do-backups        Perform backups of source to destination.                                │
│ get-size          Calculate the total size of the specified source.                        │
╰────────────────────────────────────────────────────────────────────────────────────────────╯

More information about subcommands

The information about subcommands also can be accessed using the --help flag after the parameter name. An example of using help in do-backups:

bj do-backups --help
 Usage: bj do-backups [OPTIONS]

 Perform backups of source to destination.

╭─ Options ──────────────────────────────────────────────────────────────────────────────────╮
│ *  --source       -s      PATH  Source path(s) to be backed up. [default: None] [required] │
│ *  --destination  -d      PATH  Destination directory(s) for the backups. [default: None]  │
│                                 [required]                                                 │
│    --help                       Show this message and exit.                                │
╰────────────────────────────────────────────────────────────────────────────────────────────╯