Results 1 to 4 of 4

Thread: Setting folder icon recursivly via bash script

  1. #1
    Join Date
    Sep 2015
    Beans
    8

    Setting folder icon recursivly via bash script

    Hello I would like to change all of my music folder icons via a bash script. a few years ago I found a one line solution but have since forgot it and cannot find it online.
    I can set the icon like this

    Code:
    gvfs-set-attribute -t string /home/arthur/Music metadata::custom-icon file:///home/arthur/Graphics/Revenant/Music.png
    I managed to get one folder deep with this

    Code:
    for i in /home/arthur/Music/*; do
        gvfs-set-attribute -t string "$i" metadata::custom-icon file:///home/arthur/Graphics/Revenant/Music.png
    done
    I cannot however figure out how to recursivly set all of Music's subfolders to the same Icon. If anyone can help me out it would be much appreciated.

    Using Linux Mint 18.1 Mate

  2. #2
    Join Date
    Jun 2016
    Beans
    1,861
    Distro
    Xubuntu 18.04 Bionic Beaver

    Re: Setting folder icon recursivly via bash script

    Try -
    Code:
    find /home/arthur/Music -type d -exec gvfs-set-attribute -t string {} metadata::custom-icon file:///home/arthur/Graphics/Revenant/Music.png \;
    I have not tested that command, so run this first to make sure it'll do what you want -
    Code:
    find /home/arthur/Music -type d
    Refer to man find for more info
    Xubuntu 18.04/MacBookPro9,1 ♦ openSUSE Tumbleweed/Debian 10/Xubuntu/VirtualBox
    If your questions are resolved to your satisfaction, please use Thread Tools > "Mark this thread as solved..."

  3. #3
    Join Date
    Sep 2015
    Beans
    8

    Re: Setting folder icon recursivly via bash script

    That works perfectly, thank you

  4. #4
    Join Date
    Jun 2016
    Beans
    1,861
    Distro
    Xubuntu 18.04 Bionic Beaver

    Re: Setting folder icon recursivly via bash script

    You're welcome.
    Xubuntu 18.04/MacBookPro9,1 ♦ openSUSE Tumbleweed/Debian 10/Xubuntu/VirtualBox
    If your questions are resolved to your satisfaction, please use Thread Tools > "Mark this thread as solved..."

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
  •