GIO wrapper script written in Python 3, designed for rapid import/export and clearing of Nautilus/Caja metadata, in particular emblems. It will use the GIO CLI to generate a JSON export of all the metadata attached to files/folders in a specified path. Similarly, it can ingest a JSON file to reapply all exported metadata (it relies on absolute paths here).
Run the following command and it will explain itself:
python3 emblem-exporter.py -h
Alright, alright. Let's say you want to export all the emblems in your home folder and subfolders. You can use:
python3 emblem-exporter.py -e -r /home/username emblems.json
to recursively scan /home/username and save any detected emblems into emblems.json.
Later on, once you've messed about with your emblems and irreparably mucked things up, you can import the saved state from the emblems.json file, by using:
python3 emblem-exporter.py -i emblems.json
Aren't you glad you took a backup, eh?
You can use the following command to recursively clear out a path:
python3 emblem-exporter.py -c -r /path_to_clear
BUT BE CAREFUL AS THE CHANGES ARE PERMANENT and there's no way to recover your emblems at a later point. Unless you have a neatly exported JSON file, of course.
You can specify a custom metadata filter with the -m
flag. Note that with the exception of emblems only string metadata types are supported. You can use:
python3 emblem-exporter.py -e -r -m annotation,custom-icon,emblems /home/username metadata.json
to recursively scan /home/username and save any detected annotation (aka notes), custom-icon and emblems into metadata.json.
USE CUSTOM METADATA FILTERS WITH CAUTION as they have the potential to mess up your metadata entries if used inappropriately.
Yes, as long as the absolute paths on that host are the same (for the JSON items with exported metadata), you'll be able to migrate everything correctly.