{"id":50792588,"url":"https://github.com/barisaydogdu/magic-byte-organizer","last_synced_at":"2026-06-12T12:01:46.232Z","repository":{"id":361275694,"uuid":"1249596172","full_name":"barisaydogdu/magic-byte-organizer","owner":"barisaydogdu","description":"Sorts files by their true content (magic bytes), not extensions. A concurrent daemon for Ubuntu.","archived":false,"fork":false,"pushed_at":"2026-05-29T21:41:32.000Z","size":137,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-29T23:15:34.243Z","etag":null,"topics":["cli","daemon","file-organizer","fsnotify","golang","magic-bytes","system-tool"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/barisaydogdu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-25T21:43:00.000Z","updated_at":"2026-05-29T21:41:36.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/barisaydogdu/magic-byte-organizer","commit_stats":null,"previous_names":["barisaydogdu/magic-byte-organizer"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/barisaydogdu/magic-byte-organizer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barisaydogdu%2Fmagic-byte-organizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barisaydogdu%2Fmagic-byte-organizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barisaydogdu%2Fmagic-byte-organizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barisaydogdu%2Fmagic-byte-organizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/barisaydogdu","download_url":"https://codeload.github.com/barisaydogdu/magic-byte-organizer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barisaydogdu%2Fmagic-byte-organizer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34243053,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-12T02:00:06.859Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cli","daemon","file-organizer","fsnotify","golang","magic-bytes","system-tool"],"created_at":"2026-06-12T12:00:49.186Z","updated_at":"2026-06-12T12:01:46.196Z","avatar_url":"https://github.com/barisaydogdu.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MagicSort\n\nMagicSort is a high-performance, extension-agnostic file organizer and background daemon written in Go.\n\nUnlike traditional file organizers that rely on easily spoofed or missing file extensions, such as checking whether a file ends with `.pdf`, MagicSort reads the first 512 bytes of a file to determine its true identity using **Magic Bytes**, also known as hexadecimal file signatures.\n\nThis provides accurate file type detection even when a file is downloaded as `.tmp`, `.crdownload`, has an incorrect extension, or has no extension at all.\n\n---\n\n## Key Features\n\n* **True File Type Detection:** Uses magic byte analysis to determine file types securely. A disguised executable cannot bypass the system simply by changing its extension to `.jpg`.\n\n* **Zero-CPU Background Monitoring:** Uses `fsnotify` to listen directly to operating system kernel events such as `Create`, `Rename`, and `CloseWrite`. When no file events occur, the daemon sleeps and consumes near-zero CPU.\n\n\n* **Zero Dependencies:** Compiles into a single standalone binary. No external runtime environment is required on the host machine.\n\n* **Dual Architecture: CLI \u0026 Daemon:** Powered by Cobra, MagicSort works both as a 24/7 background service and as an on-demand command-line tool.\n\n---\n\n## Installation\n\nMake sure Go is installed on your system.\n\nClone the repository and build the binary:\n\n```bash\ngit clone https://github.com/barisaydogdu/magic-byte-organizer.git\ncd magic-byte-organizer\ngo build -o magicsort ./cmd/main.go\n```\n\nOptional: move the binary to `/usr/local/bin` so it can be used globally:\n\n```bash\nsudo mv magicsort /usr/local/bin/\n```\n\nVerify the installation:\n\n```bash\nmagicsort --help\n```\n\n---\n\n## Usage\n\nMagicSort has two primary commands:\n\n* `start`: continuously monitors a directory in real time\n* `scan`: organizes an existing directory once and exits\n\n---\n\n## 1. Continuous Watcher: `start`\n\nThe `start` command runs MagicSort as a watcher/daemon and monitors the target directory in real time.\n\n```bash\nmagicsort start --dir /home/user/Downloads\n```\n\n### Flags\n\n| Flag                   | Description                                                                   |\n| ---------------------- | ----------------------------------------------------------------------------- |\n| `-d`, `--dir string`   | Target directory to watch                                                     |\n| `-t`, `--delay string` | Wait time before moving the file. Examples: `10m`, `30s`, `1h`. Default: `0s` |\n| `--dry-run`            | Simulation mode. Logs what would be moved without changing files on disk      |\n\n### Example\n\n```bash\nmagicsort start -d /home/user/Downloads -t 10m --dry-run\n```\n\n---\n\n## 2. One-Time Scanner: `scan`\n\nThe `scan` command scans and organizes all existing files in the given directory once. It does not start a continuous watcher.\n\n```bash\nmagicsort scan --dir /home/user/Downloads\n```\n\n### Flags\n\n| Flag                 | Description                                                   |\n| -------------------- | ------------------------------------------------------------- |\n| `-d`, `--dir string` | Target directory to scan                                      |\n| `--dry-run`          | Simulation mode. Logs the execution plan without moving files |\n\n### Example\n\n```bash\nmagicsort scan -d /home/user/Downloads --dry-run\n```\n\n---\n\n## Configuration\n\nMagicSort uses a `config.json` file to map detected MIME types to target folders.\n\nThe application includes smart path resolution, so it can locate the configuration file whether it is executed with `go run` or as a compiled background service.\n\n### Example `config.json`\n\n```json\n{\n  \"image/png\": \"~/Pictures\",\n  \"image/jpeg\": \"~/Pictures\",\n  \"application/pdf\": \"~/Documents\",\n  \"text/plain\": \"~/Desktop/Texts\"\n}\n```\n\n### Note About Plain Text Files\n\nText-based files such as `.txt`, `.csv`, `.md`, and `.go` usually do not contain magic bytes. They may be detected as:\n\n```text\ntext/plain\n```\n\nMap `text/plain` carefully to avoid unintentionally moving source code, notes, or project files.\n\n---\n\n\n\n## Dry Run Recommendation\n\nBefore running MagicSort on important directories, test the behavior with `--dry-run`.\n\nExample:\n\n```bash\nmagicsort scan -d /home/user/Downloads --dry-run\n```\n\nThis shows which files would be moved without actually changing the file system.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarisaydogdu%2Fmagic-byte-organizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbarisaydogdu%2Fmagic-byte-organizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarisaydogdu%2Fmagic-byte-organizer/lists"}