This tool helps you to automatically organize files and folders in your directory based on their type. It can move files into categorized subfolders, such as Documents, Images, Videos, Archives, and more. It also has the functionality to move existing folders to the correct category folders, detect duplicate files, and remove them if necessary.
- ✅ Automatically moves files to specific category folders (e.g., .pdf, .jpg, .mp4, etc.)
- ✅ Move existing folders to the correct category folders
- ✅ Detect duplicate files and remove them if necessary
- ✅ Optional: Move folders up
- ✅ Command-line interface: Use various commands to control the behavior of the tool.
- 🐍 Python 3.7 or higher
- 💻 Windows 10 or later
- 📦 Required Python libraries: os, shutil, hashlib, argparse, dotenv
-
Clone the repository
-
Install the required Python libraries:
pip install -r requirements.txt
-
Set up a
.env
file with theDIRECTORY_PATH
environment variable to the path of the directory you want to organize.DIRECTORY_PATH=path/to/your/directory
The script can be executed from the command line using the following arguments:
Path to the directory you want to organize. This argument is optional, and if not provided, the tool will use the DIRECTORY_PATH value from a .env file.
This optional flag will move any existing folders like pdf, jpg, etc., into the respective category folder.
You can specify a custom list of file types to be organized. This list should be comma-separated (e.g., .pdf
,.jpg
,.mp4
). If not specified, the default list will be used: .pdf
, .png
, .jpg
, .svg
, .zip
, .mp4
.
This optional flag will find and remove duplicate files after the user specified the duplicates to be removed.
The script will create a folder structure like this:
The tool will organize your files into the following categories based on file types:
- 🖼️ Images:
.jpg
,.jpeg
,.png
,.gif
,.svg
- 📄 Documents:
.pdf
,.docx
,.txt
,.csv
- 🎥 Videos:
.mp4
,.avi
,.mkv
,.mov
- 📦 Archives:
.zip
,.tar
,.rar
- 🗃️ Other: Any other file types not specified in the list
The tool also checks for existing folders like pdf/
, jpg/
, video/
, and moves them into the appropriate category folder.
The tool uses the SHA256
hashing algorithm to detect duplicate files in the user's directory. If duplicates are found, the user will be prompted with the option to delete them.
I welcome contributions to the File Organizer
project. If you would like to contribute, please follow these steps:
- Fork the repository.
- Clone your fork to your local machine.
- Create a new branch:
git checkout -b feature/my-new-feature
. - Make your changes and commit them:
git commit -am 'Add new feature'
. - Push your branch to your fork:
git push origin feature/my-new-feature
. - Open a pull request to merge your changes into the main repository.
Please ensure that your changes are properly tested and documented before creating a pull request.
This project is open-sourced under the MIT License - see the LICENSE file for details.