Skip to content
/ sortipy Public

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

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
LICENSE.txt
Notifications You must be signed in to change notification settings

pzzzl/sortipy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

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

Topics

Resources

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
LICENSE.txt

Stars

Watchers

Forks

Packages

No packages published

Languages