This Python script automates the organization of files in a specified directory. It categorizes files based on their extensions into folders like "Documents", "Images", "Videos", and "Others".
- Organizes files into folders based on file type.
- Supports document, image, and video file extensions.
- Automatically creates necessary directories if they do not exist.
- Handles common file extensions like
.txt,.jpg,.mp4, and more.
-
Input Directory:
When prompted, enter the full path of the directory you want to organize. -
File Sorting:
The script will create four folders in the directory if they do not already exist:- Documents:
.txt,.doc,.docx,.pdf - Images:
.jpg,.jpeg,.png,.gif - Videos:
.mp4,.mov,.avi,.mkv - Others: Files with extensions not recognized as document, image, or video will be moved to the Others folder.
- Documents:
-
File Extensions:
You can customize the extensions recognized by editing the lists ofdocument_extensions,image_extensions, andvideo_extensionsin the script. -
Folders:
The script currently creates 4 folders (Documents, Images, Videos, Others), but you can add more categories if desired by modifying the logic in theget_folder_by_extensionmethod.
Good luck with your file organization, and Happy organizing! ✨
