Are "file Notes" exclusive to Nautilus; is there a Terminal CLI?

Until today, I've avoided using the file Notes feature in Nautilus (Properties), because of portability problems. ...but they are just so tantalizingly handy! ...Adding notes to a like-named text file works, but requires more juggling that the Notes feature.

So I've decided to give the Notes a try; now that I'm (almost) exclusively using Ubuntu ...(I'm past the point of no return ;)

So a couple (or three) questions have come up.

  • Is this Notes feature exclusive to Nautilus?
  • Is there a Terminal CLI for Notes ...like the CLI for trash?
  • Is there a tool which can batch extract/convert the Notes into individual similarly named text files (or something similar) for "portability"?

I am not sure about your first and third question but it appears that it is exclusive (by that I mean that nautilus' metadata is not portable) to Nautilus and I couldn't find any tools for extracting Nautilus file annotations, but here are a few examples of how to access file annotations from the command line,

Set the notes for a file:

hello@world:~$ gvfs-set-attribute -t string Hello.txt metadata::annotation "This is a note."

Read the notes for a file:

hello@world:~$ gvfs-info -a metadata::annotation Hello.txt  
attributes:  
  metadata::annotation: This is a note.

Nautilus changed a while ago (2009?) from its own system to GVFS for storing data. All the notes are stored in a hidden GVFS database in your home-directory where at least theoretically other programs now can access it. However, the database is quite unreadable for anyone not a developer or involved with GVFS. :(

As DoR showed, you can use the gvfs-tools to read and write notes. The notes are actually written into the database, and whenever you open a folder with Nautilus, it checks the database for notes. Copying files to a different computer, different user, or a backup will not preserve the notes. If, for example, you copy a file to a memory stick the notes won't get copied. Instead Nautilus will make a new note for that copy in the database on your computer. Once you plug it back in, Nautilus finds that note. But if you go to a different computer or want to do a backup, it of course doesn't work. Pretty brain dead.

To work around this, one would have to copy the relevant parts of the database. Unfortunately, I haven't found a way yet of reading the database directly. A work-around is to have a script go through all the files you want to backup and copy the notes into separate files.

Some information/work-arounds:

  • Extracting GVFS file notes
  • A script to retrieve the notes
  • The culprit