GetNotes, a script to retrieve metadata notes!
I was going through my RSS new entries and spotted a blog post from Sathya that cought my attention!
The blog-post Sathya wrote was about files metadata. Some one asked whether there is a way to retrieve files notes as text documents or not!! The notes the person was pointing at are the ones which are written in the “Notes” tab in nautilus properties window! … but they couldn’t find an easy way to do it!
Because of my curiously, I had to know if there is a thing being done in linux that has no tool for retrieving the info out of it easily! So I googled and googled until I found this pre-installed tool
$gvfs-info which gets the metadata of any file using the following syntax!
This would return a list with all the metadata info of a specific file which wouldn’t be that practicle to get the notes from! But when using some pipes …
gvfs-info [file] | grep annotation | sed s/' metadata::annotation: '/''/g
This gives only the note, so …
gvfs-info [file] | grep annotation | sed s/' metadata::annotation: '/''/g > [output].note
saves the note as a text file and can be opened with any text editor! Seeing that I’ve done it, I was going to comment on Sethya’s blog but … I though I should be doing one thing more! And thus, a GUI python script!
Okay, not a full GUI script, I’m using zenity for the GUI part, but it is a python script! Well, the code isn’t python pure actually, I also used some shell commands! But it works! And if you’re wondering about language support, it supports UTF-8, yes Arabic is supported! ;)
Here are some screen-shots :)
It’s easy to use, all you have to do is to select all the files you want to retrieve the notes from, and click open! If one of the files does not have notes, it will not save it and will notify you! If you’re wondering, the name of the saved files will be the same as the original ones, except that they are appended with a .note!
If you’re interested, here’s the script! To be able to run it, just make sure it’s marked executable first (
$chmod +x GetNotes.py), then just run it!
$./GetNotes.py to run it from the command line!
Just in case if you can’t download it … here’s the code!
~ by AnxiousNut on September 22, 2010.