Skip to main content

A smart file copying and moving utility with hashing, filtering, and conflict resolution.

Project description

Fylex PyPI Downloads PyPI version License: MIT

Smart, Safe & Customizable File Operations Toolkit

fylex is a Python-powered CLI utility and library that enables high-performance file copying and moving with content-aware logic, parallel execution, and advanced filtering. Built for developers, sysadmins, and data engineers who need reliable and configurable file operations across platforms.

Key Highlights

  • Hash-Based File Comparison — skip identical files using xxhash
  • Multithreaded Copying — speed up transfers using ThreadPoolExecutor
  • Advanced Filtering — include/exclude via glob, regex, or filenames
  • Robust Conflict Handling — resolve duplicates by size, time, rename, etc.
  • Interactive + Dry-Run Modes — test your actions before committing
  • Logging & Summary Files — track operations with optional logs
  • Preserves Metadata — timestamps and permissions retained

Why fylex?

Most tools either blindly copy everything or require complex scripting to filter and verify safely. fylex offers a smarter alternative:

Criteria fylex rsync shutil / distutils robocopy (Windows) Other Python libs (e.g. send2trash, dirsync)
Hash-based change detection ✅ Uses xxhash to skip identical files efficiently Optional via checksum Metadata only File size/time only Varies per lib
Multi-threaded copy ThreadPoolExecutor-based parallelism Mostly single-threaded Single-threaded ✅ Parallelization possible Usually sequential
Regex + Glob + Name filtering ✅ Supports all three (rare combo) Basic include/exclude Minimal support Mask-based filtering Usually only glob
Conflict resolution strategies skip, replace, rename, larger, newer, etc. --update, overwrite-only Must handle manually Some file age support Very limited logic
Smart move ✅ Adds verified delete after copy Requires manual delete No move-and-check Overwrites or fails Not built-in
Interactive prompts ✅ Asks on conflict (optional) No CLI interactivity No interactivity Batch/script-oriented Rare
Dry-run mode ✅ Simulates full operation --dry-run Not available /L option Sometimes
Preserves metadata ✅ Via shutil.copy2() ✅ Preserves most metadata Partial (copy2 only) ✅ Full metadata support Limited
Logging and Summary ✅ Optional logs and summary file Logs via stdout No logs ✅ Built-in logs Rare
CLI + API support ✅ Both available CLI-only Python-only ✅ CLI only API only
Cross-platform ✅ Full (Linux, macOS, Windows) ✅ Mostly ✅ Yes Windows-only Varies
Extensibility / Modularity ✅ Modular design, easy to plug in new behaviors Hard to extend ✅ For basic scripting Not scriptable Sometimes messy
Active UI feedback (UX) ✅ Supports verbose/dry-run interactions Silent unless verbose No feedback Some progress reports Often silent

Positioning Strategy for fylex

Target Audience How fylex Fits Them
Developers / Engineers Precise control via regex/glob/API, great for devops/data copying
Data Analysts Safe bulk copy/move of large datasets, with dry-run + summary
Researchers / Archivists Reliable deduplication & backup tool for sensitive files
Open Source Users A modern rsync alternative with user-friendly interface
Sysadmins / Automators CLI + script combo makes it usable in crons or custom Python scripts

Main Functions

fylex.copy_files(src, dest, **options)
fylex.move_files(src, dest, **options)

Parameters

Parameter Type Description
src str Source directory or file
dest str Destination directory
no_create bool If True, do not create destination if missing
interactive bool Prompt before each operation
dry_run bool Simulate operation without modifying files
match_regex str Regex pattern to include files
match_names list[str] Exact filenames to include
match_glob str Glob pattern to include files
exclude_regex str Regex pattern to exclude files
exclude_names list[str] Exact filenames to exclude
exclude_glob str Glob pattern to exclude files
summary str Output path for log summary
on_conflict str Conflict resolution: "larger", "smaller", "newer", "older", "rename", "skip", "prompt"
max_workers int Number of threads (default 4)
verbose bool Show logs in console
has_extension bool Track extensions in duplicate detection

Example: copy_files()

from fylex import copy_files

copy_files(
    src="input_folder",
    dest="output_folder",
    match_regex=r".*\.(txt|md)$",
    exclude_names=["README.md"],
    on_conflict="rename",
    verbose=True
)

Explanation

  • Copies only .txt and .md files
  • Skips "README.md"
  • If a file already exists, renames the new one to avoid overwrite
  • Logs will show in the terminal

Example: move_files()

from fylex import move_files

move_files(
    src="raw_images",
    dest="processed_images",
    match_glob="*.png",
    dry_run=True,
    summary="move_summary.log"
)

Explanation

  • Moves all .png files (simulated due to dry_run=True)
  • Outputs actions to move_summary.log
  • Existing files are not overwritten by default

Combined Filtering Example

copy_files(
    src="data",
    dest="backup",
    match_glob="*.csv",
    match_regex=r"(?i)^data_\d{4}\.csv$",
    exclude_glob="*_old.csv",
    on_conflict="larger"
)

Explanation

  • Includes files like data_2023.csv or DATA_2022.csv
  • Excludes those matching *_old.csv
  • Replaces destination file only if the source is larger

Conflict Handling Modes

Mode Behavior
larger Keep the larger file
smaller Keep the smaller file
newer Keep the more recently modified
older Keep the older one
rename Renames new file like name(1).ext
skip Skips the file silently
prompt Asks the user for each conflict

Interactive Example

copy_files(
    src="docs",
    dest="usb",
    interactive=True,
    verbose=True
)

Explanation

  • Asks for confirmation on each file copy
  • Shows logs in the terminal

Parallelism Example

move_files(
    src="media",
    dest="external_drive",
    max_workers=8
)

Explanation

  • Moves files using 8 threads for speed
  • Ensures verification with hash+size match

Logging and Summary

copy_files(
    src="music",
    dest="phone",
    summary="music_transfer.log",
    verbose=False
)
  • Logs written to fylex.log and copied to music_transfer.log
  • Console stays silent (verbose=False)

Junk Filtering (Advanced Use)

Use JUNK_EXTENSIONS with exclude_names or exclude_glob:

from fylex import copy_files, JUNK_EXTENSIONS

copy_files(
    src="project",
    dest="clean_project",
    exclude_glob="*"+",".join(JUNK_EXTENSIONS["temporary_backup"]),
    on_conflict="skip"
)

Single File Example

copy_files(
    src="mydoc.txt",
    dest="~/backup/",
    verbose=True
)
  • Handles single files by treating parent as src and filtering by name

Installation

Install via PyPI:

pip install fylex

Or install from source:

git clone https://github.com/Crystallinecore/fylex
cd fylex
pip install .

Dependencies

  • Python 3.8+
  • xxhash: For high-speed hashing
pip install xxhash

License

MIT License © Sivaprasad Murali — https://github.com/Crystallinecore/fylex

xxHash used under BSD License — https://github.com/Cyan4973/xxHash

Author

Sivaprasad Muralisivaprasad.off@gmail.com

“Your files. Your rules. Just smarter.”

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

fylex-0.3.1.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

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

fylex-0.3.1-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file fylex-0.3.1.tar.gz.

File metadata

  • Download URL: fylex-0.3.1.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for fylex-0.3.1.tar.gz
Algorithm Hash digest
SHA256 3bd6b767829ca61f74694a2188e67b96c044f9cf9dcab643295a8fec9c2f24cd
MD5 0825a163185f403e8c59b08a2fe1a2c0
BLAKE2b-256 242b1d5e98718055083ee59e4accdc128c49556e3d0ee91e517fdb460d6efc6a

See more details on using hashes here.

File details

Details for the file fylex-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: fylex-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for fylex-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e9731568578c90e2de2c9dc993bea8bb9adc182abffc31b9423927640d29329b
MD5 d35e271838cc2259b7c2cf5c10d81089
BLAKE2b-256 762d0e5560274af3924e150ad2ffc11e7a19d9ab087415a3c0c26c2f2fac73bb

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