Skip to main content

Sort files by extension or category from the command line

Project description

███████╗ ██████╗ ██████╗ ████████╗███████╗██████╗
██╔════╝██╔═══██╗██╔══██╗╚══██╔══╝██╔════╝██╔══██╗
█████╗  ██║   ██║██████╔╝   ██║   █████╗  ██████╔╝
██╔══╝  ██║   ██║██╔══██╗   ██║   ██╔══╝  ██╔══██╗
██║     ╚██████╔╝██║  ██║   ██║   ███████╗██║  ██║
╚═╝      ╚═════╝ ╚═╝  ╚═╝   ╚═╝   ╚══════╝╚═╝  ╚═╝

Organise your Chaos : a CLI tool to sort files by extension or category (list of extensions in by genre), with recursive mode, the choice between copy/move, and a way to run in the background that watches folders in real time and auto-sorts according to the user's needs.

Requirements :

Python 3.7 + (with pip)
macOS / Linux (Windows not supported due to daemon mode)

Installation :

From my github repo :

Run these commands :

    git clone https://github.com/yourusername/filesorter.git
    cd filesorter
    pip install -e .

Usage :

FORMAT :
    filesorter <command> [arguments]

COMMANDS :

    sort <path/to/directory/that/needs/sorting> <category/filetype> <path/to/destinationDirectory> - single-time sorting (if destinationDirectory does not exist it will be created)
    watch <path/to/directory/that/needs/sorting> <category/filetype> <path/to/destinationDirectory> - continuously watch a directory and sort new files
    stop <path/to/watchedDirectory> - stop a background watcher

    HINT : use a command with only the -h flag to get help :

FLAGS :

    --recursive, -r       : Process subfolders (sort command only)
    --copy                : Copy files instead of moving (default is move)
    --background, -bg     : Run watch as background daemon (So you dont need to keep it running)
    --type EXT, -t        : Sort by a single extension (e.g. .png)
    --category CAT, -c    : Sort by predefined category (see table below)


EXAMPLES :
    filesorter sort --help      -> Gets help and format for sort command
    filesorter sort ~/Desktop ~/Documents --type .pdf --copy -> Takes all pdfs in the Desktop folder and copies them to the Documents folder
    filesorter watch ~/Desktop ~/Screenshots --category img --background -> Continuously moves all image files in the Desktop folder into the Screenshots folder in the background

CATEGORIES :
    img : .jpg, .jpeg, .png, .gif, .bmp, .tiff, .webp, .svg, .ico
    doc : .pdf, .docx, .doc, .txt, .md, .rtf, .odt, .tex
    video : .mp4, .mov, .avi, .mkv, .flv, .wmv, .webm
    audio : .mp3, .wav, .flac, .aac, .ogg, .m4a
    archive : .zip, .tar, .gz, .rar, .7z, .bz2, .xz
    code : .py, .js, .html, .css, .cpp, .c, .java, .go, .rs, .php, .rb, .swift, .kt
    spreadsheet : .xlsx, .xls, .csv, .ods
    presentation : .pptx, .ppt, .key, .odp
    executable : .exe, .msi, .app, .deb, .rpm, .sh, .bat
    diskimage : .iso, .img, .dmg
    font : .ttf, .otf, .woff, .woff2
    ebook : .epub, .mobi, .azw, .fb2
    cad : .dwg, .dxf, .stl, .obj
    database : .db, .sqlite, .sql, .mdb
    config : .json, .yaml, .yml, .xml, .toml, .ini, .cfg

Command not found after install?

If you run filesorter and get command not found, the Python scripts directory is not in your PATH.

Fix (macOS / Linux):

  1. Find where Python installs scripts:
    python3 -m site --user-base
    Then add /bin to that path (e.g., /Users/you/Library/Python/3.10/bin)
    

Add this line to your ~/.zshrc or ~/.bashrc:

export PATH="$PATH:/path/to/python/bin"

Reload your shell:

source ~/.zshrc

Or use the module directly:

python3 -m filesorter --help

This Project was created from scratch for the Stardance coding event by Hack Club inc.

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

panda_filesorter-0.2.0.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

panda_filesorter-0.2.0-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file panda_filesorter-0.2.0.tar.gz.

File metadata

  • Download URL: panda_filesorter-0.2.0.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.1

File hashes

Hashes for panda_filesorter-0.2.0.tar.gz
Algorithm Hash digest
SHA256 361055352352ee47bae01e0d248d2fc989f0740c0b6214f63c19f0c68f543923
MD5 72369216ff089bdd85f9f4ea7faa41df
BLAKE2b-256 37fa2dd15c3cd4ba6513459a26765446496536c8e3576a541ac3af14fc776a79

See more details on using hashes here.

File details

Details for the file panda_filesorter-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for panda_filesorter-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 90c1e9c6d750e12e524824ad47a3b9b7a931ef39e1ff9d8687dabdc4d5b5d27d
MD5 7ba4675e76ff98fa21024148c0906686
BLAKE2b-256 9c1f866afc67a7aa99c3c4f301985111843bbc79290ecb4d6a4278a47b6d44a8

See more details on using hashes here.

Supported by

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