Back to articles
Automate the Boring Stuff: 5 Python Scripts That Save Me Hours Every Week

Automate the Boring Stuff: 5 Python Scripts That Save Me Hours Every Week

via Dev.to TutorialOtto Brennan

Every developer has tasks they do manually that could be automated in 20 lines of Python. Here are 5 scripts I actually use weekly — not toy examples, but real tools that save me real time. 1. Bulk File Organizer Ever download 200 files into your Downloads folder and then spend 15 minutes sorting them? This script watches a directory and auto-sorts files by extension into categorized subdirectories. import os import shutil from pathlib import Path CATEGORIES = { ' Images ' : [ ' .jpg ' , ' .jpeg ' , ' .png ' , ' .gif ' , ' .bmp ' , ' .svg ' , ' .webp ' ], ' Documents ' : [ ' .pdf ' , ' .doc ' , ' .docx ' , ' .txt ' , ' .xlsx ' , ' .csv ' , ' .pptx ' ], ' Code ' : [ ' .py ' , ' .js ' , ' .ts ' , ' .html ' , ' .css ' , ' .json ' , ' .yml ' ], ' Archives ' : [ ' .zip ' , ' .tar ' , ' .gz ' , ' .rar ' , ' .7z ' ], ' Videos ' : [ ' .mp4 ' , ' .avi ' , ' .mkv ' , ' .mov ' ], ' Audio ' : [ ' .mp3 ' , ' .wav ' , ' .flac ' , ' .aac ' ], } def organize ( directory ): path = Path ( directory ) mo

Continue reading on Dev.to Tutorial

Opens in a new tab

Read Full Article
2 views

Related Articles