A Python script that automates the process of setting custom icons for folders based on folder.jpg images present within them.
- Automated Icon Setting: Recursively scans the selected directory for
folder.jpgfiles and sets them as custom folder icons. - ICO Generation: Automatically creates
.icofiles corresponding to eachfolder.jpg. - Refresh Option: Provides the ability to refresh and update existing icons based on updated
folder.jpgimages.
- This tool is designed specifically for Windows operating systems.
- It assumes the presence of
folder.jpgfiles within folders. The script does not generatefolder.jpgfiles but uses them to create and set custom folder icons.
- Clone this repository or download as a ZIP file.
- Extract the contents to your desired location.
- Ensure you have Python installed. If not, download and install Python from here.
- Install the required dependencies:
pip install -r requirements.txt- Navigate to the directory containing the script.
- Run the script using the command:
python main.py- A GUI dialog will prompt you to select the directory you wish to process.
- After selecting the directory, you will be prompted to decide if you want to refresh existing icons:
- Yes: If chosen, the script will regenerate and overwrite existing
.icofiles based on thefolder.jpgimages. This is particularly useful if anyfolder.jpgimages have been updated or changed. - No: If chosen, the script will skip folders that already have an associated
.icofile and will only process new ones.
- Yes: If chosen, the script will regenerate and overwrite existing
- The script will then process the selected directory, creating icons for the folders.
The provided demo folder contains a few sample folders with folder.jpg images to demonstrate the functionality of the script.
All photos used in the demo are under the Public Domain Dedication (CC0) license. Proper credits are provided below:
- Robin photo by Wildlife Terry
- Cardinal & Blue Jay photo by Stephen Rahn
- Yellowhammer photo by Stein Arne Jensen
- This project utilizes the Pillow library for image processing.
If after running the main script, some icons do not display correctly, it might be due to the Windows icon cache not updating properly. You can resolve this by clearing the icon cache.
- Close All Open Programs: Before you run the
delete_cache.batscript, it's essential to close all running applications to prevent any issues. - Navigate to the directory where you have the
delete_cache.batscript. - Right-click on the
delete_cache.batfile and choose "Run as administrator." - The script will forcefully close
explorer.exe, delete the icon cache, and then restartexplorer.exe. - After running the script, check the folders again. The icons should now display correctly.
Note: Always proceed with caution when running scripts that modify system processes or files. Ensure you have backups or a system restore point in place. Ive extensively commented the batch for transparency.