I have a large collection of JPG images spread across several subfolders, and they are using a lot of storage. I'd like to learn scripting by creating a tool that finds the images, converts them to WebP, and deletes the original JPG files afterward. What language and approach would be best for a beginner, and what precautions should I take before removing the originals?
4 Answers
A desktop utility such as IrfanView can batch-convert images without requiring much programming. That may solve the immediate storage problem, while writing a small Python script separately gives you a practical way to learn scripting and automation.
Start by converting a small test folder instead of running the script on your entire collection. Compare the WebP files for quality and size first, since WebP does not automatically guarantee a major reduction over JPG. Keep backups, and don’t delete the originals until you’ve verified that the conversions open correctly.
Python is a good choice for this because it’s beginner-friendly and has libraries for both file management and image conversion. The Pillow library can open JPG files and save them as WebP. You’d then add code to walk through the folder tree, process matching files, and only delete each original after confirming that the WebP was created successfully.
If you use Linux or macOS, Bash tools such as find and ImageMagick can handle this. Learning find is especially useful because it teaches you how to search through nested directories and run commands on matching files. PowerShell can fill a similar role on Windows.

Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically