If there are pictures in folder A, B, C.....Z, how do I automatically set the first picture in each of these folders as its folder icon? Is there a way like a script or something else?
If there are pictures in folder A, B, C.....Z, how do I automatically set the first picture in each of these folders as its folder icon? Is there a way like a script or something else?
1. Automatically change folder icon into the first found image inside
The python script below will change the icon of all folders inside a directory (recursively) into the first found valid image file inside the folder.
The script
Download from Pastebin
How to use
change_icon.py
Run it with the targeted directory as an argument:
That's it!
2. More advanced
...is to make it a right-click option in nautilus:
The script is slightly different then:
Download from Pastebin
To use
Create, if it doesn't exist yet, the directory
Copy the script into an empty file, save it in
~/.local/share/nautilus/scripts
asset_foldericons
(no extension!), and make it executable.Notes
os.path.realpath()
is used, this also works if the targeted folder is a link.EDIT
Undo (reset) the custom icons inside a directory recursively
If, for some reason you'd like to reset the icons inside a folder to their default icon(s), use the script below. Simply:
reset_icons.py
run it by the command:
The script
"gvfs-set-attribute" in script 1. will make error in python3 Ubuntu 18.0.4
I change to