2

When I copy a file through Nautilus its emblem or icon is preserved, but if I do it with cp or rsync through CLI it isn't. Why, and how to fix it?

By preserved I mean that icons that I have manually changed stay like that when copying through Nautilus, and are otherwise reset to the default icons when copying through CLI.

Strapakowsky
  • 12,304

3 Answers3

3

I wrote a small Perl script that solves this issue, metasave. It saves nautilus metadata in the form of a shell script that you need to run on the destination system.

If you want to copy files on the command line and preserve their metadata, you need to use gvfs-copy, Gnome's replacement of cp.

despens
  • 126
  • 7
1

WHY: Emblems are not a part of the file itself, they're stored somewhere inside Gnome - when you copy files using Nautilus, it is able to update the metadata in Gnome because Nautilus is a Gnome app and is aware of the existance of labels and emblems.

cp, rsync and other non-Gnome commands, on the other hand, know nothing about labels and emblems and can do nothing to preserve them.

HOW TO FIX: There may be no good way to fix it for every command-line utility which copies files. For some selected commands, such as cp you may look at writing some wrappers which set the emblems of the target files to match the emblems of the source files. This post may give you some pointers at how to set emblems from command line

Sergey
  • 44,353
0

Try using rsync with the archive flag:

rsync -av <source> <dest>

It could be that nautilus is preserving permissions such as executable and rsync & cp unless told are not.

map7
  • 1,346
  • 1
  • 7
  • 15