This is a small Python project that organizes all files in a folder into subfolders based on their extensions. I always had a mess with files in my Download directory. Now I just have to run main.py and files will be sorted into subfolders according to their file types.
Download the repository and place it in the desired directory. It will organize the parent (../) directory
Parent Directory
└─── organizer
│ │ __init__.py
│ │ main.py
│ │ handler.py
│ file1.jpg
│ file2.pdf
│ ...
Now, open a terminal in the organizer directory and run:
python main.py
To change a directory name, modify the value in the type_to_directory_name to the desired value. For example:
type_to_directory_name = {
'text': 'Texts',
}
can be changed to:
type_to_directory_name = {
'text': 'NewText',
}
To add a new extension, edit extension_to_handler in FileHandlerDispatcher:
self.extension_to_handler = {
...
'stl': '3d'
}
And add the corresponding folder name:
type_to_directory_name = {
'3d': '3D Files',
}
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.