Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a collection of films on my computer and every film is stored in its own folder with image of its cover.

What I would like to do is to change icon of each folder to icon of film's cover. Is there any way to do this quicker than right-clicking on each folder and changing icons manually?

share|improve this question
My acquirement also same! – HabeebPerwad May 20 '14 at 11:57
up vote 5 down vote accepted

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.

share|improve this answer
This is what I was looking for, thank you very much. – Glimmung Jan 22 '12 at 2:35
For Igor Cavour Oliveira: In that case you can type at the command line:" how can i write this comand line in an shellscript instead of in the shell? – Videonauth Jun 10 at 12:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.