35

As stated in rsync's man page, the -a (archive) switch is equivalent to -rlptgoD. However, I have a situation where I don't want symbolic links retained. Is there any way to keep using the -a switch and prevent copying of symbolic links? I could write -rptgoD every time, but it's a bit long.

kasperd
  • 30,455
  • 17
  • 76
  • 124
Hay
  • 473
  • 1
  • 4
  • 6

2 Answers2

75

Try the following:

rsync -a --no-links ...

or, the slightly shorter:

rsync -a --no-l ...

Note that the --no-links/--no-l switch must come after the -a switch on the command line, otherwise the --links implied by -a is turned back on again.

Steven Monday
  • 13,599
  • 4
  • 36
  • 45
  • 1
    I don't see the --no-links option in the [rsync help pages](http://rsync.samba.org/ftp/rsync/rsync.html). When did they add this option? – palswim May 21 '14 at 17:42
  • 14
    @palswim: See the `--no-OPTION` option in the man page. `-l`/`--links` is implied by the `-a` option, and hence can be turned off by the corresponding `--no-OPTION` option. – Steven Monday May 22 '14 at 01:32
5

No. You could use an alias instead. Put the line

alias mrsync="rsync -rptgoD"

inside your ~/.profile and after the next login, you can call just mrsync and have these parameters implicit with the alias.

Sven
  • 98,649
  • 14
  • 180
  • 226