linux – How to copy symlinks to a device that does not support symlinks?


I am trying to backup a directory to a Samba share, which apparently does not support symlinks.

Are there any good solutions of how to proceed?

I would suggest a sensible behaviour might be to

  • Dereference and copy symlinks (copy the file) if the symlink is valid
  • Ignore the symlink (do not copy anything) if the symlink is invalid

Reason for this is I have some analysis project where there were some symlinks which used to point to some large input data. These are no longer valid because the data was on a seperate location. Loosing this information (not copying the symlinks) is unimportant.

There may be other symlinks which link to real files which still exist, however, and I would like to preserve these.

I’m aware I could tarball the directory, which I will do, for a second copy.