Skip to main content

A Python library for sorting and organizing files.

Project description

ArrangeLT

Overview

ArrangeLT is a Python library designed to help users quickly and efficiently sort and organize files in a directory. It provides functionality to sort files alphabetically, group files by extensions, categorize files by size, and more.

Installation

To install the library, you can use pip. Run the following command in your terminal:

pip install arrangelt

Usage

Here is a simple example of how to use the library:

Sorting Files Alphabetically

from arrangelt import alth_sort

# Sort files alphabetically in ascending order (default)
sorted_files = alth_sort("path/to/directory", style="asc", include_path=True)
print(sorted_files)

# Sort files alphabetically in descending order
sorted_files = alth_sort("path/to/directory", style="desc", include_path=False)
print(sorted_files)

Grouping Files by Extension

from arrangelt import ext_sort

# Group files by their extensions
grouped_files = ext_sort("path/to/directory", include_path=True)
print(grouped_files)

# Group files by their extensions, excluding specific types (e.g., .tmp and .log)
grouped_files = ext_sort("path/to/directory", exclude_types=[".tmp", ".log"], include_path=False)
print(grouped_files)

# Group files by their extensions, including only specific types (e.g., .txt and .csv)
grouped_files = ext_sort("path/to/directory", include_types=[".txt", ".csv"], include_path=True)
print(grouped_files)

Categorizing Files by Size

from arrangelt import size_sort

# Categorize files by size using default size categories
size_categories = {
    "small": (0, 10 * 1024 * 1024),   # Files smaller than 10 MB
    "medium": (10 * 1024 * 1024, 100 * 1024 * 1024),  # Files between 10 MB and 100 MB
    "large": (100 * 1024 * 1024, 1 * 1024 * 1024 * 1024),  # Files between 100 MB and 1 GB
    "extra_large": (1 * 1024 * 1024 * 1024, float('inf'))  # Files larger than 1 GB
}

categorized_files = size_sort("path/to/directory", size_categories=size_categories, include_path=True)
print(categorized_files)

# Example output:
# {
#     "small": ["path/to/directory/file1.txt"],
#     "medium": ["path/to/directory/file2.txt"],
#     "large": ["path/to/directory/file3.txt"],
#     "extra_large": ["path/to/directory/file4.txt"]
# }

Features

  • Alphabetical Sorting:

    • Sort files in ascending or descending order by their names.
    • Option to include or exclude the full file path in the output.
  • Extension Grouping:

    • Group files by their extensions.
    • Option to include or exclude the full file path in the output.
    • Include only specific file types or exclude specific file types.
  • Size Categorization:

    • Categorize files into size-based groups (e.g., small, medium, large).
    • Fully customizable size categories.
    • Option to include or exclude the full file path in the output.
  • Error Handling:

    • Provides clear error messages for invalid paths, permissions, and other issues.
  • Non-File Handling:

    • Automatically ignores non-file items (e.g., directories, symbolic links) when sorting or categorizing.

License

This project is licensed under the Apache-2.0 License - see the LICENSE file for details.

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

arrangelt-0.2.0.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

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

arrangelt-0.2.0-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: arrangelt-0.2.0.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for arrangelt-0.2.0.tar.gz
Algorithm Hash digest
SHA256 879712a0cb7783fc0a9136beae66f4b8994a3df7d12d0dd107f404b8936916a5
MD5 e28e092ac2260d5c63a9e15db6345ec0
BLAKE2b-256 9e608b0137aeef86957462f45b1c33f7f78b91578ef079d59e670c56ae8214df

See more details on using hashes here.

File details

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

File metadata

  • Download URL: arrangelt-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for arrangelt-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6783e0fd5018b47874784ccc72550747380050998586657e4f0796eea1b22e62
MD5 4ad635369fc7e13cdd669c9a3303034d
BLAKE2b-256 0adfd6f40c925532cc1568d4c3f98e3a92653792331f49ea6ab2dc431fd38654

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