Skip to main content

a commandline utility to create file backups

Project description

mkbak.py

PyPI PyPI - Python Version PyPI - License Scrutinizer code quality (GitHub/Bitbucket) PyPI - Format

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

  • Run mkbak [options] to start searching for files to backup from your current directory

Arguments

  • -h, --help display all options
  • --version print version information
  • -a, --all show hidden and 'dot' files
  • --ansi enable processing of ANSI color codes
  • --bind custom keybindings. refer to fzf's manpage
  • -d, --delete iterate through '.bak' files to delete
    • please note that this search can take a while, as it's only returning '.bak' files
  • -e, --exact exact matching
  • --height [HEIGHT] display fzf window with the given height
    • Please note that the --height argument will be overridden if set to '100' and the environment variable $FZF_DEFAULT_OPTS contains --height set to something other than '100'
  • -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 the padding inside fzf'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: '> ')
  • -q [QUERY], --query [QUERY] start the finder with the given query
  • -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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mkbak-1.2.2.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

mkbak-1.2.2-py3-none-any.whl (19.6 kB view details)

Uploaded Python 3

File details

Details for the file mkbak-1.2.2.tar.gz.

File metadata

  • Download URL: mkbak-1.2.2.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using 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.57.0 CPython/3.7.9

File hashes

Hashes for mkbak-1.2.2.tar.gz
Algorithm Hash digest
SHA256 e168abf31f3e13ff91f5f35c1eaa2ce85026bf6a8d08a83d233fcdc0417e924f
MD5 7d2b64396ac0c3fb684ac309eb0cc88a
BLAKE2b-256 ee11e81c063a4d0986e9b1f86d6e798cc1569452e9ce1f63f24c1fb467dbe35b

See more details on using hashes here.

File details

Details for the file mkbak-1.2.2-py3-none-any.whl.

File metadata

  • Download URL: mkbak-1.2.2-py3-none-any.whl
  • Upload date:
  • Size: 19.6 kB
  • Tags: Python 3
  • Uploaded using 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.57.0 CPython/3.7.9

File hashes

Hashes for mkbak-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 22075799d6517525d83d9fe0d783f10495e16d7d78494e8eae866bbbceefe13e
MD5 2d54ccdbef413143f56279d52e465a8f
BLAKE2b-256 bb4ceebaa83f6e9edc77a5d48dc67d74de5568c95c356872d35736e721be76d4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page