{"id":13448132,"url":"https://github.com/deadc0de6/catcli","last_synced_at":"2025-04-06T04:06:36.600Z","repository":{"id":27534678,"uuid":"114283890","full_name":"deadc0de6/catcli","owner":"deadc0de6","description":"The command line catalog tool for your offline data","archived":false,"fork":false,"pushed_at":"2024-02-17T20:43:40.000Z","size":419,"stargazers_count":194,"open_issues_count":0,"forks_count":17,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-04-14T06:55:14.865Z","etag":null,"topics":["catalog","commandline","indexer","python3"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deadc0de6.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"ko_fi":"deadc0de6"}},"created_at":"2017-12-14T18:35:14.000Z","updated_at":"2024-04-13T09:35:14.000Z","dependencies_parsed_at":"2024-01-23T15:09:22.516Z","dependency_job_id":"9903b374-85bb-44d4-aa06-7e711f8ecd33","html_url":"https://github.com/deadc0de6/catcli","commit_stats":{"total_commits":276,"total_committers":4,"mean_commits":69.0,"dds":"0.036231884057971064","last_synced_commit":"3cf3031af204b4c4beb8f4429522a3610844d9e6"},"previous_names":[],"tags_count":52,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deadc0de6%2Fcatcli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deadc0de6%2Fcatcli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deadc0de6%2Fcatcli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deadc0de6%2Fcatcli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deadc0de6","download_url":"https://codeload.github.com/deadc0de6/catcli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247430864,"owners_count":20937874,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["catalog","commandline","indexer","python3"],"created_at":"2024-07-31T05:01:36.586Z","updated_at":"2025-04-06T04:06:36.573Z","avatar_url":"https://github.com/deadc0de6.png","language":"Python","readme":"# CATCLI\n\n[![Tests Status](https://github.com/deadc0de6/catcli/workflows/tests/badge.svg?branch=master)](https://github.com/deadc0de6/catcli/actions)\n[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](http://www.gnu.org/licenses/gpl-3.0)\n[![Coverage](https://codecov.io/gh/deadc0de6/catcli/graph/badge.svg?token=t5dF7UL7K1)](https://codecov.io/gh/deadc0de6/catcli)\n\n[![PyPI version](https://badge.fury.io/py/catcli.svg)](https://badge.fury.io/py/catcli)\n[![AUR](https://img.shields.io/aur/version/catcli-git.svg)](https://aur.archlinux.org/packages/catcli-git)\n[![Python](https://img.shields.io/pypi/pyversions/catcli.svg)](https://pypi.python.org/pypi/catcli)\n\n[![Donate](https://img.shields.io/badge/donate-KoFi-blue.svg)](https://ko-fi.com/deadc0de6)\n\n*The command line catalog tool for your offline data*\n\n\u003e [!WARNING]\n\u003e catcli has been superseded by [gocatcli](https://github.com/deadc0de6/gocatcli/)\n\u003e which provides all features of catcli and more...\n\nDid you ever wanted to find back that specific file that should be on one of your\nbackup DVDs or one of your external hard drives? You usually go through all\nof them hoping to find the right one on the first try?\n[Catcli](https://github.com/deadc0de6/catcli) indexes external media\nin a catalog file and allows to quickly find specific files or even navigate in the\ncatalog of indexed files while these are not connected to your host.\n\nFeatures:\n\n  * Index any directories in a catalog\n  * Ability to search for files by name in the catalog\n  * Ability to navigate through indexed data à la `ls`\n  * Support for fuse to mount the indexed data as a virtual filesystem\n  * Handle archive files (zip, tar, ...) and index their content\n  * Save catalog to json for easy versioning with git\n  * Command line interface FTW\n  * Store files and directories sizes\n  * Store md5 hash of files\n  * Ability to update the catalog\n  * Support for `fzf` for finding files\n  * Tag your different storages with additional information\n  * Export catalog to CSV\n\n\u003ca href=\"https://asciinema.org/a/hRE22qbVtBGxOM1yxw2y4fBy8\"\u003e\u003cimg src=\"https://asciinema.org/a/hRE22qbVtBGxOM1yxw2y4fBy8.png\" width=\"50%\" height=\"50%\"\u003e\u003c/a\u003e\n\nQuick start:\n\n```bash\n# install catcli with pip\npip3 install catcli --user\n# index a directory in the catalog\ncatcli index --meta='some description' log /var/log\n# display the content\ncatcli ls -r\n# navigate\ncatcli ls log\n# find files/directories named '*log*'\ncatcli find log\n# show directories sizes\ncatcli du log\n```\n\nsee [usage](#usage) for specific info\n\n## Why catcli?\n\n[Catcli](https://github.com/deadc0de6/catcli) gives the ability to navigate,\nexplore and find your files that are stored on external media\n(DVDs, hard drives, USB sticks, etc) when those are not connected.\nCatcli can just as easily index any arbitrary directories.\n\nSee the [examples](#examples) for an overview of the available features.\n\n---\n\n**Table of Contents**\n\n* [Installation](#installation)\n* [Usage](#usage)\n\n  * [Index data](#index-data)\n  * [Index archive files](#index-archive-files)\n  * [Walk indexed files with ls](#walk-indexed-files-with-ls)\n  * [Find files](#find-files)\n  * [Mount catalog](#mount-catalog)\n  * [Display entire hierarchy](#display-entire-hierarchy)\n  * [Disk usage](#disk-usage)\n  * [Catalog graph](#catalog-graph)\n  * [Edit storage](#edit-storage)\n  * [Update catalog](#update-catalog)\n  * [CSV format](#csv-format)\n\n* [Examples](#examples)\n* [Contribution](#contribution)\n* [Thank you](#thank-you)\n\n# Installation\n\nInstall from Pypi\n```bash\n$ pip3 install catcli --user\n```\n\nOr from github directly\n```bash\n$ cd /tmp; git clone https://github.com/deadc0de6/catcli \u0026\u0026 cd catcli\n$ sudo python3 setup.py install\n$ catcli --help\n```\n\nTo work with catcli without installing it, you can do the following\n```bash\n$ cd /tmp; git clone https://github.com/deadc0de6/catcli \u0026\u0026 cd catcli\n$ pip3 install -r requirements.txt --user\n$ python3 -m catcli.catcli --help\n```\n\nor install it in a virtualenv\n```bash\n$ cd /tmp; git clone https://github.com/deadc0de6/catcli \u0026\u0026 cd catcli\n$ virtualenv -p python3 env\n$ source env/bin/activate\n$ python setup.py install\n$ catcli --help\n```\n\nCatcli is also available on aur: https://aur.archlinux.org/packages/catcli-git/\n\n# Usage\n\nEach indexed directory is stored in the catalog. Multiple directories can be indexed\nand they are all available through the command line interface of catcli.\n\nFive different types of entry are present in a catalog:\n\n  * **top node**: this is the root of the hierarchy\n  * **storage node**: this represents an indexed storage (a DVD, an external\n    hard drive, an USB drive, some arbitrary directory, etc).\n  * **dir node**: this is a directory\n  * **file node**: this is a file\n  * **archive node**: this is a file contained in an archive (tar, zip, etc)\n\nFollowing environment variables are supported:\n\n* `CATCLI_CATALOG_PATH`: define the catalog path (`--catalog=\u003cpath\u003e`)\n* `CATCLI_NO_BANNER`: disable the banner (`--no-banner`)\n* `CATCLI_VERBOSE`: enable verbose mode (`--verbose`)\n* `CATCLI_FORMAT`: define the output format (`-F --format=\u003cfmt\u003e`)\n\n## Index data\n\nLet's say the DVD or external hard drive that needs to be indexed\nis mounted on `/media/mnt`. The following command\nwill index the entire directory `/media/mnt`\nand store that in your catalog under the name `\u003cshort-name\u003e`.\n\n```bash\n$ catcli index --meta=\u003csome-description\u003e \u003cshort-name\u003e /media/mnt\n```\n\nIf not specified otherwise (with the switch `--catalog`), the catalog is saved in the current\ndirectory under `catcli.catalog`.\n\nThe `--meta` switch allows to add any additional information to store along in\nthe catalog like for example `the blue disk in my office`.\n\nUsing the `-a --archive` switch allows to also index archive files as explained\n[below](#index-archive-files).\n\n## Index archive files\n\nCatcli is able to index and explore the content of archive files.\nFollowing archive formats are supported: *tar*, *tar.gz*, *tar.xz*, *lzma*, *tar.bz2*, *zip*.\nCatcli is also able to find files within indexed archive files.\n\nSee the [archive example](#archive-example) for more.\n\n## Walk indexed files with ls\n\nA catalog can be walked using the command `ls` as if the media\nis mounted (File/directories separator is `/`).\n\n```bash\n$ catcli ls tmp/a/b/c\n```\n\nResulting files can be sorted by size using `-S --sortsize`.\nSee the [examples](#examples) for more.\n\n## Find files\n\nFiles and directories can be found based on their names\nusing the `find` command.\n\n`Find` support two formats that allow to use `fzf` for\nsearching:\n\n* `--format=fzf-native`: display the result in native format\n* `--format=fzf-csv`: display the result in csv\n\nSee the [examples](#examples) for more.\n\n## Mount catalog\n\nThe catalog can be mounted with [fuse](https://www.kernel.org/doc/html/next/filesystems/fuse.html)\nand navigate like any filesystem.\n\n```bash\n$ mkdir /tmp/mnt\n$ catcli index -c github .github\n$ catcli mount /tmp/mnt\n$ ls -laR /tmp/mnt\ndrwxrwxrwx - user  8 Mar 22:08 github\n\nmnt/github:\n.rwxrwxrwx 17 user 19 Oct  2022 FUNDING.yml\ndrwxrwxrwx  - user  2 Mar 10:15 workflows\n\nmnt/github/workflows:\n.rwxrwxrwx 691 user 19 Oct  2022 pypi-release.yml\n.rwxrwxrwx 635 user  8 Mar 21:08 testing.yml\n```\n\n## Display entire hierarchy\n\nThe entire catalog can be shown using the `ls -r` command.\nResulting files can be sorted by size using the `-S --sortsize` switch.\n\nSee the [examples](#examples) for more.\n\n## Disk usage\n\nYou can get the disk usage with the `du` command.\nResulting files can be sorted by size using the `-S --sortsize` switch.\n\n## Catalog graph\n\nThe catalog can be exported in a dot file that can be used to\ngenerate a graph of the indexed files.\n\n```bash\n$ catcli graph\ndot file created under \"/tmp/catcli.dot\"\ncreate graph with \"dot /tmp/catcli.dot -T png -o /tmp/tree.png\" (you need graphviz)\n$ dot /tmp/catcli.dot -T png -o /tmp/tree.png\n```\n\n## Edit storage\n\nStorage entry can be edited with following catcli commands:\n\n* `rename` - rename the storage\n* `edit` - edit storage metadata\n\n## Update catalog\n\nThe catalog can be updated with the `update` command.\nUpdates are based on the access time of each of the files and on the\nhash checksum if present (catalog was indexed with `-c --hash` and\n`update` is called with the switch `-c --hash`).\n\n## CSV format\n\nResults can be printed to CSV using `--format=csv`.\nFields are separated by a comma (`,`) and are quoted with double quotes (`\"`).\n\nEach line contains the following fields:\n\n* **name**: the entry name\n* **type**: the entry type (file, directory, storage, etc)\n* **path**: the entry path\n* **size**: the entry size\n* **indexed_at**: when this entry was indexed\n* **maccess**: the entry modification date/time\n* **md5**: the entry checksum (if any)\n* **nbfiles**: the number of children (empty for nodes that are not storage or directory)\n* **free_space**: free space (empty for not storage nodes)\n* **total_space**: total space (empty for not storage nodes)\n* **meta**: meta information (empty for not storage nodes)\n\n# Examples\n\n## Simple example\n\nLet's first create some files and directories:\n\n```bash\n$ mkdir -p /tmp/test/{a,b,c}\n$ echo 'something in files in a' \u003e /tmp/test/a/{1,2,3}\n$ echo 'something else in files in b' \u003e /tmp/test/b/{4,5,6}\n$ echo 'some bytes' \u003e /tmp/test/c/{7,8,9}\n$ tree /tmp/test\n/tmp/test\n├── a\n│   ├── 1\n│   ├── 2\n│   └── 3\n├── b\n│   ├── 4\n│   ├── 5\n│   └── 6\n└── c\n    ├── 7\n    ├── 8\n    └── 9\n\n3 directories, 9 files\n```\n\nFirst this directory is indexed with `catcli` as if it was some kind of\nexternal storage:\n\n```bash\n$ catcli index --meta='my test directory' tmptest /tmp/test\n```\n\nCatcli creates its catalog file in the current directory as `catcli.catalog`.\n\nPrinting the entire catalog as a tree is done with the command `ls -r`\n\n```\n$ catcli ls -r\ntop\n└── storage: tmptest (my test directory) (nbfiles:3, free:3.7G/3.7G, date:2019-01-26 19:59:47)\n    ├── a [nbfiles:3, totsize:72]\n    │   ├── 1 [size:24]\n    │   ├── 2 [size:24]\n    │   └── 3 [size:24]\n    ├── b [nbfiles:3, totsize:87]\n    │   ├── 4 [size:29]\n    │   ├── 5 [size:29]\n    │   └── 6 [size:29]\n    └── c [nbfiles:3, totsize:33]\n        ├── 7 [size:11]\n        ├── 8 [size:11]\n        └── 9 [size:11]\n```\n\nThe catalog can be walked with `ls` as if it was a normal directory\n\n```\n$ catcli ls\ntop\n- storage: tmptest (my test directory) (nbfiles:3, free:3.7G/3.7G, date:2019-01-26 19:59:47)\n\n$ catcli ls tmptest\nstorage: tmptest (my test directory) (nbfiles:3, free:3.7G/3.7G, date:2019-01-26 19:59:47)\n- a [nbfiles:3, totsize:72]\n- b [nbfiles:3, totsize:87]\n- c [nbfiles:3, totsize:33]\n\n$ catcli ls tmptest/b\nb [nbfiles:3, totsize:87]\n- 4 [size:29]\n- 5 [size:29]\n- 6 [size:29]\n```\n\nAnd files can be found using the command `find`\n\n```bash\n$ catcli find 9\n\nc/9 [size:11, storage:tmptest]\n```\n\nWhen using the `-b --script` switch, a one-liner is generated\nthat allows to handle the found file(s)\n\n```\n$ catcli find 9 --script\n\nc/9 [size:11, storage:tmptest]\nop=file; source=/media/mnt; $op ${source}/c/9\n```\n\n## Archive example\n\nLet's consider a directory containing archive files:\n\n```bash\n$ ls -1 /tmp/catcli\ncatcli-0.3.1\nv0.3.1.tar.gz\nv0.3.1.zip\n```\n\nTo enable the indexing of archive contents use\nthe `-a --archive` switch\n\n```bash\n$ catcli index -au some-name /tmp/catcli\n```\n\nThen any command can be used to explore the catalog as for normal\nfiles but, by providing the `-a --archive` switch, archive content are displayed.\n\n```bash\n$ catcli ls some-name\n\n   storage: some-name (free:800G, total:1T)\n   - catcli-0.3.1 [nbfiles:11, totsize:80.5K]\n   - v0.3.1.tar.gz [size:24.2K]\n   - v0.3.1.zip [size:31.2K]\n\n$ catcli ls -r some-name/v0.3.1.zip\n\n   v0.3.1.zip [size:31.2K]\n\n$ catcli ls -ar some-name/v0.3.1.zip\n\n   v0.3.1.zip [size:31.2K]\n   ├── catcli-0.3.1 [archive:v0.3.1.zip]\n   │   ├── catcli [archive:v0.3.1.zip]\n   │   │   ├── __init__.py [archive:v0.3.1.zip]\n   │   │   ├── catalog.py [archive:v0.3.1.zip]\n   │   │   ├── catcli.py [archive:v0.3.1.zip]\n   │   │   ├── logger.py [archive:v0.3.1.zip]\n   │   │   ├── noder.py [archive:v0.3.1.zip]\n   │   │   ├── utils.py [archive:v0.3.1.zip]\n   │   │   └── walker.py [archive:v0.3.1.zip]\n   │   ├── .gitignore [archive:v0.3.1.zip]\n   │   ├── LICENSE [archive:v0.3.1.zip]\n   │   ├── MANIFEST.in [archive:v0.3.1.zip]\n   │   ├── README.md [archive:v0.3.1.zip]\n   │   ├── requirements.txt [archive:v0.3.1.zip]\n   │   ├── setup.cfg [archive:v0.3.1.zip]\n   │   ├── setup.py [archive:v0.3.1.zip]\n   │   ├── tests [archive:v0.3.1.zip]\n   │   │   ├── __init__.py [archive:v0.3.1.zip]\n   │   │   ├── helpers.py [archive:v0.3.1.zip]\n   │   │   ├── test_find.py [archive:v0.3.1.zip]\n   │   │   ├── test_graph.py [archive:v0.3.1.zip]\n   │   │   ├── test_index.py [archive:v0.3.1.zip]\n   │   │   ├── test_ls.py [archive:v0.3.1.zip]\n   │   │   ├── test_rm.py [archive:v0.3.1.zip]\n   │   │   └── test_tree.py [archive:v0.3.1.zip]\n   │   ├── tests.sh [archive:v0.3.1.zip]\n   │   └── .travis.yml [archive:v0.3.1.zip]\n   └── catcli-0.3.1/ [archive:v0.3.1.zip]\n```\n\n# Contribution\n\nIf you are having trouble installing or using catcli, open an issue.\n\nIf you want to contribute, feel free to do a PR (please follow PEP8).\n\nThe `tests.sh` script can be run to check the code.\n\n# Thank you\n\nIf you like catcli, [buy me a coffee](https://ko-fi.com/deadc0de6).\n\n# License\n\nThis project is licensed under the terms of the GPLv3 license.\n\n","funding_links":["https://ko-fi.com/deadc0de6"],"categories":["Python","System Utilities"],"sub_categories":["Directory Navigation"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeadc0de6%2Fcatcli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeadc0de6%2Fcatcli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeadc0de6%2Fcatcli/lists"}