Czkawka

repository·master·Indexed 11 days ago

https://github.com/qarmin/czkawka

A high-performance, multiplatform file cleaning tool written in Rust. It includes a core scanning library (czkawka_core) and multiple frontends, including a CLI, a GTK-based GUI (deprecated as of version 12.0), a Slint-based GUI called Krokiet, and a touch-friendly Android GUI called Cedinia. Czkawka is used to find duplicate files, similar media, empty folders, large files, and other unnecessary files.

Tokens
50.1K
Snippets
167
Records
256
Agent score
49%

What's inside Czkawka

  1. Overview of Czkawka frontends

    master

    Czkawka provides several different interfaces depending on your platform and needs:

    • Krokiet: The new generation GUI frontend. It is simple, multiplatform (Linux, macOS, Windows), and uses the Slint framework. This is the recommended version for new users.
    • Czkawka (GUI): The older GTK 4-based frontend. Note: Version 12.0 is the last released version; no new binaries will be provided.
    • Cedinia: A touch-friendly Android GUI frontend built with Slint.
    • Czkawka CLI: A command-line interface for easy automation.
    • Czkawka Core: The underlying Rust library used by all frontends and available for external integration.
  2. Overview of available scanning tools in czkawka_core

    master

    The czkawka_core library provides a variety of specialized scanning tools for file management and cleanup. The available tools include:

    • Duplicate Finder: Finds duplicate files.
    • Empty Files: Finds files with zero size.
    • Empty Folders: Finds empty directories.
    • Big Files: Finds files exceeding a certain size.
    • Temporary Files: Finds files that are typically considered temporary.
    • Invalid Symlinks: Finds broken or invalid symbolic links.
    • Same Music: Finds music files that are identical (often based on audio content).
    • Similar Images: Finds visually similar images.
    • Similar Videos: Finds visually similar videos.
    • Broken Files: Finds corrupted or unreadable files.
    • Bad Extensions: Finds files with incorrect or suspicious extensions.
    • Bad Names: Finds files with problematic names.
    • Exif Remover: (Tool for handling EXIF data).
    • Video Optimizer: (Tool for video optimization).
  3. Overview of Cedinia features and limitations

    master

    Cedinia provides a mobile interface for Czkawka Core scanning tools.

    Supported Tools

    It supports the same scanning tools as Krokiet, including:

    • Duplicates
    • Similar images and videos
    • Empty files and folders
    • Large files
    • Invalid extensions
    • Duplicate music
    • And more

    Missing Features

    The following features are currently unavailable because they require FFmpeg:

    • Similar video detection based on frames
    • Detection of corrupted video files
    • Video optimization

    Known Issues

    • Keyboard Support: Multiple issues exist due to bugs in the Slint framework.
    • Display: Only portrait mode is supported with specific aspect ratios, which may cause layout issues on tablets or certain devices.
  4. Overview of Czkawka Core

    master
    czkawka_core is the central scanning library for the Czkawka ecosystem. It provides the implementation for all scanning tools, including duplicate files, empty folders, similar images, similar videos, and broken files. It is designed as a pure Rust library with no UI dependencies, making it suitable for embedding into various frontends such as Czkawka GUI, Czkawka CLI, Krokiet, and Cedinia.
  5. Krokiet Interface Overview

    master

    The Krokiet interface consists of six main areas:

    1. Left panel: Tool selector containing 14 tools and a Settings gear.
    2. Results area: Displays scan results as grouped rows.
    3. Action bar: Contains Scan/Stop buttons, selection helpers, and action buttons (delete, move, etc.). Includes toggles for the Directory panel and Error log.
    4. Status bar: Shows current scan state or result summary (e.g., "Found N items in Xms").
    5. Directory panel: Toggled via the folder icon. Shows Included Paths (to be scanned) and Excluded Paths (to be ignored).
    6. Right pane: Optional panel for image previews or tool sub-settings (e.g., for Similar Images).
  6. Use Czkawka GTK GUI components

    master

    The Czkawka GTK interface is organized into several functional areas:

    • Image Preview (1): Displays images for duplicate or similar file comparison. It cannot be resized and can be disabled.
    • Main Notebook (2): Used to switch between different scanning tools (e.g., Duplicate Files, Similar Images).
    • Main Results Window (3): Displays scan results; used for choosing, deleting, and configuring files.
    • Bottom Panel (4): Contains action buttons (like selection tools) and visibility toggles for GUI elements.
    • Text Panel (5): Displays system messages, warnings, and errors. This panel can be hidden.
    • Directory Panel (6): Used to manage included/excluded directories, allowed file extensions, and file size limits.
    • Settings & About (7): Buttons to access application settings and information.
  7. Understand the duplicate finder's two-stage hashing cache

    master

    The duplicate finder uses a two-stage pipeline to optimize performance. Because of this, you will see two distinct cache files:

    1. Prehash Cache: Stores fast, partial hashes computed from small chunks at the start and end of files. This is used to quickly eliminate non-duplicates. It is computationally cheap to build.
    2. Full Hash Cache: Stores cryptographically strong hashes of the entire file content. This is only computed for files that passed the prehash stage and serves as the authoritative signal for deduplication.

    Managing the cache:

    • To fix corruption: Delete the files in the cache directory (e.g., ~/.cache/czkawka/). The next scan will rebuild them.
    • To edit paths manually: Enable "Save also as JSON" in the GUI settings. You can then edit the .json file and delete the .bin file to force the app to load your edited version.
  8. Integrate with Czkawka Core

    master

    Developers can reuse Czkawka's functionality by using the czkawka_core crate. This core library is written in Rust and powers all official frontends.

    External projects can interact with Czkawka in several ways:

    1. Direct Dependency: Depend on the czkawka_core Rust crate.
    2. Python Bindings: Use the official Python bindings available on PyPI.
    3. CLI Wrapper: Wrap czkawka_cli to perform scans and retrieve results in JSON format.
    4. Tauri: Use existing implementations like czkawka-tauri for web-tech based GUIs.
  9. How duplicate detection and hashing work

    master

    Czkawka identifies duplicates using a multi-stage hashing pipeline (size + prehash + full hash) rather than a byte-by-byte comparison. This is highly efficient and reliable.

    Hashing Pipeline

    1. Grouping: Files are first grouped by exact size.
    2. Hashing: Only files with identical sizes are compared using hashes.
    3. Algorithms:
      • Blake3 (Default): Fast and cryptographically strong. Recommended for deduplication.
      • CRC32: Fast checksum, not cryptographic.
      • XXH3 (xxHash): Very fast, not cryptographic.

    Content vs. Name

    • Hash method: Files with different names but identical content (same size and same hash) will be reported as duplicates.
    • Name method: If you only want to find duplicates with the same filename, use the "Name" check method instead.
  10. Configure hardlink visibility in scan results

    master
    To prevent already-hardlinked files from being flagged as duplicates, enable the "Ignore same inode" (or "Hide hardlinks") setting. When enabled, files sharing the same inode number are treated as a single logical file, and only one representative is shown in the results.
  11. Understand symlink behavior and the Symlink action

    master

    By default, Czkawka does not follow symbolic links. A symlink is treated as its own filesystem entry, and the scan will not traverse into the target. To scan the contents of a symlinked directory, add the target path directly to the included directories.

    When you perform the "Symlink" action on selected (duplicate) files:

    1. Czkawka replaces the selected files with symlinks.
    2. These symlinks point to the first unselected file in the group.
    3. The original (unselected) file remains intact.
    4. The selected files are replaced in-place.

    Note: On Windows, creating symlinks requires elevated privileges or Developer Mode to be enabled.

  12. Understand Czkawka terminology and core concepts

    master

    Czkawka uses specific terminology to manage file scanning and protection across its different frontends:

    • Reference paths: Paths marked as "Reference paths" (via UI checkbox or CLI flag) are used for comparison but are protected. They cannot be modified, moved, or deleted by any automatic action. This is useful for comparing a working folder against a master backup or using a dataset as a read-only baseline. Supported by: Duplicate Files, Similar Images, Similar Videos, and Same Music.
    • Included / Excluded paths: Included paths are scanned; excluded paths are explicitly ignored.
    • Excluded items: Glob patterns (e.g., */tmp*, */.git) matched against full file and directory paths. These are more flexible than excluded paths but slightly slower.
    • Configuration vs Cache:
      • Configuration is frontend-specific (GTK, Krokiet, and CLI do not share config).
      • Cache is shared across all frontends. It contains computed data like hashes, thumbnails, and analysis results to avoid recomputation.