How can I change the icons of many folders?
You can do this from the command line:
gvfs-set-attribute -t string <directory> metadata::custom-icon file://<icon-location>
replacing <directory>
with the name of the directory you want a custom icon for and <icon-location>
with the location of the icon. For example, to change the icon of ~/Documents to a red apple:
gvfs-set-attribute -t string ~/Documents metadata::custom-icon file:///usr/share/pixmaps/apple-red.png
Now, to automate the process a bit, say that you have a directory ~/Videos/Films
inside which you have one directory per film, each of which containing a file called icon.png
that contains the desired icon. In that case you can type at the command line:
{ while read -r d ; do [ -d "$d" ] && [ -e "$d/icon.png" ] || continue ; gvfs-set-attribute -t string "$d" metadata::custom-icon "file://$d/icon.png" ; done ; } < <(find ~/Videos/Films -mindepth 1 -maxdepth 1 -type d)
Notice that an open nautilus window will need to be refreshed in order for any icon changes performed on the command line to take effect.