Caja Lesson Learned with Notes

So I just scanned in about 100 photos. Spent time coming up with appropriate file names and entering additional information under the notes tab. I was using a folder on my desktop as my working directory. When completed, I copied this folder to a new drive and deleted the folder from my desktop. I went to the new drive, all the photos were there, but the notes were all gone. So I went to the Trash and restored the deleted directory. The notes were all gone from those files as well. So apparently notes in Caja are only good if the files never move? Notes seems like a worthless Caja feature to me.

Between two Ubuntu Mate, synchronizing files via Dropbox, the notes have disappeared.

So I googled a bit and found this link,
there is a script to save the notes in a text, it must be executed before deleting or moving files:

I tried it on a pdf file and it worked, it should be tested more extensively.

The reason is that notes are not part of the files, but are stored in ~ / .local / share / gvfs-metadata

Agree. Relatively useless. Same is with folder colours and Icons. If you move a folder they get lost. At least that was experience with 18.04 a while back.

Maybe ... but sometimes I write notes and I hope this feature will be maintained.

I made a screencast to read the output of the terminal and the result is that gvfs-info is a deprecated command. In fact the script in the link in my previous post works only for one file, even if there are several in the folder.

So I replaced gvfs-info with info -a metadata :: annotation and I got 2 scripts:

N° 1 is a command to give on the terminal and saves all notes together in one text file
It works both on files and folders (even with name containing a space).
Moreover it also reports annotations even if they are composed of multiple lines.

gio info -a metadata::annotation [file] | sed s/' metadata::annotation: '/''/g > [output].txt

Replace [file] with the list of files or folders, you can also drag and drop, and [output] with the name we want.

The result will be for example:

uri: file: ///home/.../..../file1.pdf
let everyone read it
uri: file: ///home/.../..../file2.xlsm
remember to check the items
uri: file: ///home/.../..../file3.png
get it printed
uri: file: ///home/.../..../HL_HUB.pdf
instructions of the new modem

N° 2

This script saves the notes in separate text documents, each one with the file name. When we display in alphabetical order, each note is right next to its file. But it doesn't work on folders (I don't know why).
It only recognizes the first line of text in the note tab and ignores any text beyond the first linefeed. Here in the comments a change to the script is proposed but but I could not make it work.

IFS=$'\n' # don't use <space>,<tab> to split words 
process_dir() {
 local -a subdirs=()
 echo "Scanning directory: $1"

 # Scan the directory, processing files and collecting subdirs
 for file in "$1"/*; do
 if [[ -f "$file" ]]; then
 echo "Processing file: $file"
 # actually deal with the file here...

 #gio info -a metadata::annotation $file | grep annotation | sed s/' metadata::annotation: '/''/g > $file.note
 note=$(gio info -a metadata::annotation "$file" | grep annotation | sed s/' metadata::annotation: '/''/g)
 #len=`echo ${#note}`
 #echo $len
 if [ -z "$note" ]
 echo "No note for file $file"
 echo "Found a note for file \"$file\", saying: \"$note\""
 echo "$note" > $file.text

 fi     # $String is null.

 elif [[ -d "$file" ]]; then
 # If you don't care about processing all files before subfolders, just do:
 # process_dir "$file"

 # Now go through the subdirs
 for d in "${subdirs[@]}"; do
 process_dir "$d"

if [[ -z "$1" ]]; then
 read -p "Please enter a directory for me to scan" dir
process_dir "$dir"

It goes without saying that these scripts should be applied before moving the files

Although I believe it 's better and easier the N1, I modified the script N 2 to make it work even with files that have a name containing a space, but the bug of notes with multiple lines remains.