Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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 at 11:57

1 Answer 1

up vote 3 down vote accepted
+150

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

Your Answer

 
discard

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.