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
  • 11,914

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
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
  • 43,665
  • Are all emblems icons? Does what you described for emblem apply for icons in general as well? – Strapakowsky Jun 04 '12 at 01:03
  • Great link ! Didn't know how to do that. In any case my problem here is that when I rsync a folder icons in dest are reset. – Strapakowsky Jun 04 '12 at 01:05
  • What do you mean by "icons are reset"? Do you mean the main file icon is getting changed? From what is it getting changed to what? – Sergey Jun 04 '12 at 01:28
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,246