Results 1 to 9 of 9

Thread: Set Custom Directory Icon From Command Line

  1. #1
    Join Date
    Jul 2008
    Beans
    31

    Set Custom Directory Icon From Command Line

    Hello. I am looking for a way to (via bash script) set a custom directory icon for a number of directories. All of these directories contain a "cover.jpg" image. I can accomplish this manually by right clicking the directory > select "Properties > click the directory icon button > select the "cover.jpg" image. I am just looking for the way to do this in the terminal to save time, as the music collection is quite large. Thanks in advance.
    IBM ThinkPad T23 (1.13Ghz, 1Gb, Hardy Heron)
    IBM ThinkPad X31 (1.70Ghz, 1Gb, Intrepid Ibex)
    IBM IntelliStation M Pro (3.20Ghz, 1Gb, Intrepid Ibex)

  2. #2
    Join Date
    Aug 2009
    Location
    Lambda Core
    Beans
    96
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Set Custom Directory Icon From Command Line

    found this solution from - http://old.nabble.com/How-do-I-chang...d25832597.html

    In gvfs 2.28 you can use gvfs-info and gvfs-set-attribute to get and set
    any metadata.
    To get the custom icon value;
    # gvfs-info -a metadata::custom-icon myfolder

    To set a custom icon
    # gvfs-set-attribute myfolder metadata::custom-icon
    file:///usr/share/pixmaps/gnome-spider.png

    Hope this helps, I too was looking for this.

  3. #3
    Join Date
    Oct 2009
    Beans
    25

    Re: Set Custom Directory Icon From Command Line

    Sorry for bring up a old thread....

    But now that you set the custom icon from the terminal...how do you "un"set it back to the standard/default icon?

  4. #4
    Join Date
    Oct 2009
    Beans
    25

    Re: Set Custom Directory Icon From Command Line

    BUMP

    Still cant figure this out...

  5. #5
    Join Date
    Jul 2010
    Beans
    1

    Re: Set Custom Directory Icon From Command Line

    But now that you set the custom icon from the terminal...how do you "un"set it back to the standard/default icon?
    One way is to just go Right Click>Properties>Click on icon>Revert.
    But i don't know how to do it in the terminal.

  6. #6
    Join Date
    Jul 2010
    Beans
    1

    Re: Set Custom Directory Icon From Command Line

    This should have the same effect as selecting 'revert' from the icon properties window:

    Code:
    gvfs-set-attribute -t stringv myfolder metadata::custom-icon ""
    This declares the attribute type to be 'stringv' before setting it blank ( "" ). Might seg fault if you don't include the empty quotes.

    Use at own risk &c.

  7. #7
    Join Date
    Sep 2007
    Beans
    642
    Distro
    Ubuntu Development Release

    Re: Set Custom Directory Icon From Command Line

    This doesn't seem to work for me. I'm testing it on my Dropbox folder, but the icon never changes. Is there something more that I need to do?

    EDIT:
    Nevermind, I got it working.
    Last edited by kyleabaker; November 19th, 2010 at 11:36 AM.

  8. #8
    Join Date
    Jan 2008
    Beans
    11

    Re: Set Custom Directory Icon From Command Line

    kyleabaker,

    What did you do to get it working?

    Mark

  9. #9
    Join Date
    Aug 2009
    Location
    India
    Beans
    63
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Set Custom Directory Icon From Command Line

    Hi all,

    I know, this is an old thread, but this is really for the benefit of others who might stumble upon this.

    The command to reset the icon for a folder is
    Code:
    gvfs-set-attribute myfolder -t unset metadata::custom-icon

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •