Skip to main content

mkbak.py

PyPI PyPI - Python Version PyPI - License Scrutinizer code quality (GitHub/Bitbucket) PyPI - Format GitHub last commit GitHub code size in bytes

mkbak is a commandline utility to painlessly create file backups.
It interfaces with fzf as a menu for file selection, allowing you to quickly select files.

Installation

With Pip

  • pip install --user -U mkbak

With Poetry

  • Download the repository:
    • git clone https://github.com/sudo-julia/mkbak
  • Enter the repo
    • cd mkbak
  • Install dependencies:
    • poetry install
  • Run mkbak:
    • poetry run mkbak
      • To avoid typing this every time you want to run the program, you can alias the above command with: alias mkbak='poetry run mkbak'.

From Source

  • Download the repository:
    • git clone https://github.com/sudo-julia/mkbak
  • Enter the repo
    • cd mkbak
  • Build the package:
    • python3 setup.py sdist bdist_wheel
  • Install from the local build
    • pip install --user -U .
  • Run mkbak:
    • mkbak
    • Please note that running from a local build may not set up the entry point correctly, resulting in: bash: command not found: mkbak. In this case, simply run alias mkbak='python3 -m mkbak'. This sets up mkbak to be run as a module when mkbak is typed, which solves the entry point problem. You can add the alias command to the bottom of your shell's configuration file for it to be set automatically at your terminal's initialization.

Usage

usage: mkbak [-h] [-a] [--ansi] [--bind BIND] [-d] [-e] [--height HEIGHT] [-i] [--no_mouse] [--no_recursion]
             [--no_sort] [--padding PADDING] [-p PATH] [--preview PREVIEW] [--print_query] [--prompt PROMPT]
             [-q QUERY] [-u] [-v] [--version]

optional arguments:
  -h, --help            show this help message and exit
  -d, --delete          iterate through '.bak' files to delete
  -q QUERY, --query QUERY
                        start the finder with the given query
  -u, --unbak           restore files to their most recent backup
  --version             print version information

  -a, --all             show hidden and 'dot' files
  --ansi                enable processing of ANSI color codes
  --bind BIND           custom keybindings. refer to fzf's manpage
  -e, --exact           exact matching
  --height HEIGHT       display fzf window with the given height
  -i, --ignore_case     ignore case distinction
  --no_mouse            disable mouse interaction
  --no_recursion        run mkbak without recursing through subdirectories
  --no_sort             don't sort the results
  --padding PADDING     padding inside the menu's border
  -p PATH, --path PATH  directory to iterate through (default '.')
  --preview PREVIEW     starts external process with current line as arg
  --print_query         print query as the first line
  --prompt PROMPT       input prompt (default: '> ')
  -v, --verbose         explain what is being done

Example

  • mkbak -vi --path "$folder" -q 'pdf$' will launch mkbak searching $folder, query files ending in 'pdf', ignore case distinctions in file names and print out any errors along with files successfully copied

Requirements

Changelog

See CHANGELOG.md

Bugs

Open an issue or PR

TODO

  • Package for pypi
  • Define entry point so the program can be run as mkbak
  • Add all options to README
  • Github releases
  • Move argument parsing to a separate module
  • Mode to replace a regular file with its backup
  • Create documentation
  • Shell completions

Credits

Thanks to junegunn for making fzf

Thanks to dahlia for making iterfzf

Metadata

Release files for mkbak 1.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mkbak 1.3.2
File Size Uploaded
mkbak-1.3.2.tar.gz 7.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mkbak 1.3.2
File Interpreter ABI Platform
mkbak-1.3.2-py3-none-any.whl Python 3 none any Details

Total release size: 28.4 kB

Release files / mkbak-1.3.2.tar.gz

Download URL mkbak-1.3.2.tar.gz
Size 7.4 kB
Tags Source
SHA-256 checksum
How to use checksums
83afeea70b39efac6cc95fc7f90d560b01dc61ae3c79637f62c46409cfc194e7
BLAKE2b-256 checksum
How to use checksums
9795519c9d2997bc9ad51ae6d4a19392e36a7ff3860c7ea434789a712da79189
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.7.10

Release files / mkbak-1.3.2-py3-none-any.whl

Download URL mkbak-1.3.2-py3-none-any.whl
Size 20.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0859bcaa4753d7201498ff6901fdf4314134c56ad8de5551befd2a941eb5ac87
BLAKE2b-256 checksum
How to use checksums
4d9c2281362ae18d15ebe44692d08dd87e2ce6178ae210b3bd73d839daa05081
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.7.10

Release history Release notifications | RSS feed

This release

1.3.2 This release

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page