jaylann / FolderSorterByFiletype

File Sorter is a handy tool that organizes files and folders in a specified directory. It groups files by type and can even find and remove duplicates if needed. With a simple command, you can clean up cluttered directories, making your files easier to find and manage.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

File Sorter

File Sorter is a simple Python script that organizes files in a specified directory based on their file extensions. It moves the files to their respective folders named after their file extensions. Loose folders will also be moved to a central 'Folders' folder. Additionally, it can identify and remove duplicate files when using the --unique flag.

Features

  • Classifies files based on their extensions and moves them to corresponding folders.
  • Handles duplicate file names by renaming.
  • Moves loose folders to a central 'Folders' folder.
  • Optionally identifies and removes duplicate files based on MD5 hashes (enabled with the --unique flag).
  • Interactive prompt to allow users to view, confirm, or deny deletion of duplicate files.

Installation

  1. Clone the repository:

    git clone https://github.com/jaylann/FolderSorterByFiletype.git
  2. Navigate to the project directory:

    cd FolderSorterByFiletype
  3. Install dependencies:

    pip install -r requirements.txt

Usage

You can use the script from the command line by specifying the target directory as an argument. Optionally, use the --unique flag to enable duplicate file removal:

python file_sorter.py /path/to/target/directory --unique

Example

If you have a directory with the following structure:

Documents/
├── file1.txt
├── file2.pdf
└── Folder1/

Running the script on this directory will reorganize it as:

Documents/
├── TXT Files/
│   └── file1.txt
├── PDF Files/
│   └── file2.pdf
└── Folders/
    └── Folder1/

If there are any duplicate files, you will be prompted to delete them or view the list of duplicates.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

About

File Sorter is a handy tool that organizes files and folders in a specified directory. It groups files by type and can even find and remove duplicates if needed. With a simple command, you can clean up cluttered directories, making your files easier to find and manage.

License:GNU General Public License v3.0


Languages

Language:Python 100.0%