Skip to main content

Enrich your command-line shell with Herculean cleaning capabilities

Project description

Alfeios

Enrich your command-line shell with Herculean cleaning capabilities


full

As fifth Labour, Heracles was charged with cleaning the Augean stables . The beautiful stables had not been cleaned for thirty years and were overshadowed in filth. Instead of turning to the mop and bucket, Heracles used a radically innovative tool: the Alfeios river waters and managed to wash everything in just one day.

Let's do a comparison with the data on your hard drives. Backups have been made, files have been renamed, directories have been moved ... Slowly but surely things have diverged significantly, up to a point where you did not feel safe to delete anything. That is where things got worse as you started accumulating duplicates, sacrificing all hopes to control your data. As a result cleaning your hard drives now appears to you as the fifth labour of Heracles, humanly impossible.

Alfeios is an innovative tool that makes this overwhelming task feasible. It recursively indexes the content of your hard drives, going inside zip, tar, gztar, bztar and xztar compressed files. Its index is content-based, meaning that two files with different names and different dates will be identified as duplicate if they share the same content. This will tell you when files can safely be removed, gaining space and cleaning data on your hard drives.

Install

pip install alfeios

Run

Alfeios is a software that operates from a command-line interface in a shell.

Upon installation, on any operating system thanks to the magic of Python entry points, three commands are added to your shell. One low-level command: alfeios index and two high-level commands: alfeios duplicate and alfeios missing.

alfeios index

Index content of a root directory:

  • Index all file and directory contents in a root directory including the inside of zip, tar, gztar, bztar and xztar compressed files
  • Contents are identified by their hash-code, type (file or directory) and size
  • It saves two files tagged with the current time in a .alfeios folder in the root directory:
    • A tree.json.file that is a dictionary: path -> content
    • A forbidden.json file that lists paths with no access

Example:

alfeios index
alfeios idx D:/Pictures
alfeios i

alfeios idx and alfeios i can be used as aliases for alfeios index

If no positional argument is passed, the root directory is defaulted to the current working directory.

alfeios duplicate

Find duplicate content in a root directory:

  • List all duplicated files and directories in a root directory
  • Save result as a duplicate_listing.json file tagged with the current time in a .alfeios folder in the root directory
  • Print the potential space gain

Example:

alfeios duplicate
alfeios dup -s D:/Pictures
alfeios d D:/Pictures/.alfeios/2020_01_29_10_29_39_listing.json

alfeios dup and alfeios d can be used as aliases for alfeios duplicate

If no positional argument is passed, the root directory is defaulted to the current working directory.

The '-s' or '--save-index' optional flag saves the tree.json and forbidden.json files tagged with the current time in a .alfeios folder in the root directory.

If a tree.json file is passed as positional argument instead of a root directory, the tree is deserialized from the json file instead of being generated, which is significantly quicker but of course less up to date.

alfeios missing

Find missing content in a new root directory from an old root directory:

  • List all files and directories that are present in an old root directory and that are missing in a new one
  • Save result as a missing_listing.json file tagged with the current time in a .alfeios folder in the old root directory
  • Print the number of missing files

Example:

alfeios missing D:/Pictures E:/AllPictures
alfeios mis -s D:/Pictures E:/AllPictures
alfeios m D:/Pictures/.alfeios/2020_01_29_10_29_39_listing.json E:/AllPics

alfeios mis and alfeios m can be used as aliases for alfeios missing

The '-s' or '--save-index' optional flag saves the tree.json and forbidden.json files tagged with the current time in a .alfeios folder in the 2 root directories.

If a tree.json file is passed as positional argument instead of a root directory, the corresponding tree is deserialized from the json file instead of being generated, which is significantly quicker but of course less up to date.

For developers

git clone https://github.com/hoduche/alfeios

Then from the newly created alfeios directory, run:

pip install -e .

And in a Python file, call:

import pathlib

import alfeios.api

folder_path = pathlib.Path('D:/Pictures')
alfeios.api.index(folder_path)

To build:

flake8 -v alfeios tests
pytest -vv
python3 -m build
python3 -m twine upload dist/*

Areas for improvement

Viewer

For the moment Alfeios output are raw json files that are left at the user disposal. A dedicated json viewer with graph display could be a better decision support tool.

File Manager

For the moment Alfeios is in read-only mode. It could be enriched with other file manager CRUD functions, in particular duplicate removal possibilities.

File System

For the moment Alfeios is only a add-on to the command line shell. Its content-based index could be further rooted in the file system and refreshed incrementally after each file system operation, supporting the copy-on-write principle .

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

alfeios-1.4.tar.gz (43.4 kB view details)

Uploaded Source

Built Distribution

alfeios-1.4-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file alfeios-1.4.tar.gz.

File metadata

  • Download URL: alfeios-1.4.tar.gz
  • Upload date:
  • Size: 43.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.5

File hashes

Hashes for alfeios-1.4.tar.gz
Algorithm Hash digest
SHA256 dcb5b923539d52064dff7e9da0df44399ac4bda0d91a9a7671481dc4b23ed2d6
MD5 0dd30ec2d036fb355d0dacb3276502c8
BLAKE2b-256 a9945f06e0ac58f2683ab5c8aa5a4d37e06b5c0c1cb3209fd54c79ad5366dcd7

See more details on using hashes here.

File details

Details for the file alfeios-1.4-py3-none-any.whl.

File metadata

  • Download URL: alfeios-1.4-py3-none-any.whl
  • Upload date:
  • Size: 13.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.5

File hashes

Hashes for alfeios-1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 de8f71bb53ebd27428558c1ee6c52f0c3b352965b7011c982894c4d48d7737c0
MD5 f19a3c853426795e9537e2fe7e38b020
BLAKE2b-256 bb7ffd360f5969391147731cf883736a8ec0b7a8c2d72922a1946f08e78deb7e

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