Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am using Nautilus' options to add meta-data to files a lot. For example, I use manual positioning of Icons, have many files with custom icons and emblems, etc.

How can I copy all this meta-information to another computer? I understand that using rsync or similar classic file copying mechanisms only copy the name, timestamps and contents of files, but the not the luxury stuff Nautilus provides. Even when I move files via a mounted remote drive via Nautulus itself, this metadata is not copied.

Thanks for any help.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

I solved the problem with a small Perl script, see https://github.com/despens/metasave


use 5.10.0;
use strict;
use utf8;
use File::Find;
use String::ShellQuote;

sub handler {
    my $filename = shell_quote($_);
    my $metadata = qx/gvfs-info -a metadata::* $filename/ or die "$filename: $!\n";
    my @lines = split(/\n /s, $metadata);
    for my $line (@lines) {
        my ($attribute, $value) = $line =~ m/^\s*(\S+): (.+)$/s;
        if($attribute and $value) {
            # is there an array in the value?
            if($value =~ m/^\[.+\]$/s) {
                $value =~ s/^\[(.+)\]$/$1/gs;
                my @values = split(/[\[\],\s]+/s, $value);
                map shell_quote, @values;
                my $stringv = join(' ', @values);

                say "gvfs-set-attribute $filename -t stringv $attribute $stringv ;";
            else {
                if($value ne '[]') {
                    $value = shell_quote($value);
                    say "gvfs-set-attribute $filename $attribute $value ;";

say "#!/bin/sh";

find({wanted => \&handler, follow => 0, no_chdir => 1}, '.');
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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