This Python script recursively scans a folder and its subdirectories, identifies image files, and renames them using a standardized format (image.jpg, image_1.png, image_2.jpeg, etc.).
- Recursively scans folders and subfolders
- Supports common image file types (
.png,.jpg,.jpeg,.gif,.bmp,.webp) - Automatically renames images in each folder using a consistent naming pattern
- Skips non-image files
- Prints logs for every file processed and renamed
- Set the
root_dirvariable to the folder path you want to scan. - The script walks through the folder and all subfolders.
- For every image found, it renames it to
image,image_1,image_2, etc., within its respective folder.
If a folder contains:
photo.jpg
dog.png
cat.jpeg
After running the script, it becomes:
image.jpg
image_1.png
image_2.jpeg
Run the following command to check:
python --versionIf Python is not installed, download it from python.org.
Update the root_dir variable to point to your target directory:
root_dir = r'C:\Users\YourName\Desktop\your_folder'From your terminal or command prompt:
python image_renamer.py.png.jpg.jpeg.gif.bmp.webp
- Files will be renamed in place — original filenames will be overwritten.
- Make a backup if you want to preserve the original names.
Pull requests are welcome!
Please ensure any changes are tested and clearly documented.
This project is licensed under the MIT License. "# image-renamer"