Skip to main content

Sortipy is designed to help you organize files in a directory by sorting them based on their file extensions.

Project description

Sortipy

Sortipy is a Python package designed to help you organize files in a directory by sorting them based on their file extensions.

Summary

Installation

Upload Python Package
You can install Sortipy using pip:

pip install sortipy

Usage

from sortipy import sortipy

# Sort files in a directory without specifing extensions
sort_everything = sortipy.sort("path/to/your/directory")

# Sort files in a directory and specify extensions to consider
sort_specific_extensions = sortipy.sort("path/to/your/directory", extensions=["pdf", "txt"])

# Print the sorted results
print(sort_everything)

Parameters

  • path (str): The path to the directory containing files to be sorted.
  • extensions (List[str], optional): A list of file extensions to consider during sorting. Defaults to an empty list. If not provided, Sortipy considers all file extensions in the directory.

Returns

A dictionary containing sorted files grouped by their extensions. Keys represent file extensions, and values are lists of file names.

Example

Suppose you have a directory "C:/Users/username/Downloads" with the following files:

  • report.pdf
  • notes.txt
  • picture.jpg
  • document.docx
  • presentation.pptx

You can sort the PDF and TXT files with Sortipy:

from sortipy import sortipy

# Sort PDF and TXT files in the Downloads directory
results = sortipy.sort("C:/Users/username/Downloads", extensions=["pdf", "txt"])

# Print the sorted results
print(results)

Output:

{
    'pdf': ['report'],
    'txt': ['notes']
}

Now, the PDF and TXT files are moved to their respective folders within the Downloads directory.

Default Behavior

By default, Sortipy considers all file extensions in the directory for sorting. If you want to do this, you don't need to pass the extensions list. Only the directory will work just fine.

Contributing

If you'd like to contribute to Sortipy, please feel free to submit pull requests or open issues on the GitHub repository.

License

This project is licensed under the MIT License.

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

sortipy-0.0.6.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

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

sortipy-0.0.6-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file sortipy-0.0.6.tar.gz.

File metadata

  • Download URL: sortipy-0.0.6.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for sortipy-0.0.6.tar.gz
Algorithm Hash digest
SHA256 25ebc575fcc9a0a11b86349765c7746205881883a572883b05f010840ba0d912
MD5 28bec1596e3a5c347849d7c1ee20affe
BLAKE2b-256 849ac7c9f98c3f7843e0b637949c0ca925099448d1fe63bf062093e2fab736a2

See more details on using hashes here.

File details

Details for the file sortipy-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: sortipy-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for sortipy-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 54f0358cde347f7c76c72119fac8b404c73c7ff781175df5b1682c291e5c5fdb
MD5 a7a5a758c0c01eb4129c44ba04fa81ab
BLAKE2b-256 07aaa26ce8c8684e52eee855d8f0df251974b8e7523465c67d1da58137d2814b

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