I'd like to be able to determine what emblem a file has from the command line. Is there a way to determine this? Also, is there a way to apply emblems from the command line?

I usually have a cron job that trashes files over 7 days old in my ~/Downloads, but I'd like to be able to only delete files that don't have a particular emblem (my seeding torrents). I've been applying these emblems manually, but if I can automate that as well, that'd be awesome.

My usual cron job is just a simple find command:

find /home/zach/Downloads/ -ctime +7 -exec trash {} \;


I solved my own question.


To elaborate on exactly what I'm doing, I use deluge-torrent to manage my downloads. I am now using the execute plugin to run this script on torrent complete:

#!/usr/bin/env bash
# deluge gives the download directory name as the third argument
gvfs-set-attribute -t stringv "$3" metadata::emblems ubuntuone-unsynchronized

I then created my trasher.sh (this requires the trash-cli package):

#!/usr/bin/env bash
[[ "$(gvfs-info -a metadata::emblems $*)" =~ "ubuntuone-unsynchronized" ]] || trash "$*"

Now, I just modify my cron to:

find /home/zach/Downloads/ -maxdepth 1 -ctime +7 -exec /home/zach/Scripts/trasher.sh {} \;

And voila! Now Deluge can manage its downloads, while my cleanup script can safely cleanup old files without interfering with seeding torrents.

  • 3
    What a good idea! :) – invert Sep 1 '10 at 8:40

<Juhaz> in ##gnome on freenode got it.

gvfs-info -a metadata::emblems FOLDER

will retrieve the emblem of a folder/file and

gvfs-set-attribute -t stringv FOLDER metadata::emblems EMBLEM

will allow you to set emblem of the folder/file.

|improve this answer|||||
  • 3
    And metadata is stored on ~/home/.local/share/gvfs-metadata. There is one file per partition/volumen if I understand it right. Binary files. Ugly is you ask me, but likely faster than xml files. – Javier Rivera Sep 1 '10 at 15:15
  • Thats where they first pointed me to when I asked in ##gnome. Lots of binary .log files. I made the mistake of cat *'ing the dir. It also seems that the files there never get cleaned out? – aperson Sep 1 '10 at 15:44
  • 1
    Doesn't work on 12.04. – Fish Monitor Jul 1 '12 at 13:38

This post explains how emblem information is stored in a XML file under ~/.nautilus/metafiles. First you'd need to test if the XML related to each download exists, and if so, whether it contains the emblem of your choice.

|improve this answer|||||
  • 2
    My ~/.nautilus/ folder is 100% empty... – 8128 Sep 1 '10 at 9:18
  • 3
    Old info, this was changed on Lucid. And BTW I will also love to know where does nautilus store them now. – Javier Rivera Sep 1 '10 at 11:13
  • Yeah, I already read that post (sorry, should have specified). But as others have commented, that information is no longer relevant. I even tried searching for .xml files in my ~ and nothing came up other than some things for other programs. – aperson Sep 1 '10 at 13:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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