This Python script automatically organizes files in a specified directory (e.g., your Downloads folder) into categorized subfolders based on their file types. The script supports a wide range of file extensions and can handle duplicates, empty folders, and logs its actions.
- Automatic File Sorting: Moves files into categorized folders based on their extensions.
- Wide File Type Support: Includes categories like Images, Documents, Videos, Audio, Archives, Coding files, and more.
- Duplicate Handling: Renames files if a file with the same name already exists in the destination folder.
- Empty Folder Cleanup: Automatically deletes empty folders after sorting.
- Logging: Logs all actions (e.g., file moves, errors) into a
file_sorting.log
file.
-
Clone the repository:
git clone https://github.com/GylanSalih/OrganizeMyFiles
-
Navigate to the project directory:
cd OrganizeMyFiles
-
Install dependencies (if any): The script requires Python 3.x. No additional Python packages are required.
-
Open the script in your preferred text editor.
-
Modify the
download_folder
variable to point to the directory you want to organize:download_folder = 'C:/Users/YourUsername/Downloads'
-
Run the script:
python OrganizeMyFiles.py
-
The script will organize files into subfolders within the specified directory based on their file types.
You can customize the file types and categories by editing the file_types
dictionary in the script:
file_types = {
'Images': ['.jpg', '.jpeg', '.png', ...],
'Documents': ['.pdf', '.docx', ...],
...
}
Add or remove extensions as needed to fit your specific requirements.
The script creates a OrganizeMyFiles.log
file in the project directory, where it logs all actions such as successful file moves, error messages, and deleted empty folders.
If you'd like to contribute to this project, please fork the repository and use a feature branch. Pull requests are warmly welcome.
This project is licensed under the MIT License - see the LICENSE.md file for details.