I want to rsync a folder to another folder without copying links. When I do this and the origin folder contains a symbolic link to a directory, I get the following error message:

skipping non-regular file "FOLDER"

(The error message does not actually cause rsync to stop but I prefer not to receive error messages when a program is behaving as I expect.)

Here is an example (which creates test/ and rsyncs to test2/):

mkdir -p test/subdir/subsubdir/
ln -s "$(pwd)"/test/subdir/subsubdir test/subdir/subsubdir_link
rsync -a --no-l test/ test2/

Additionally, the following rsync command (where I give the options in -a except for -l and -D) also give the error message:

rsync -rptgo test/ test3/

Is there some way to prevent this behaviour within rsync?

  • If you use backquotes (or triple backquotes as in your case) your code/command blocks have tiny white lines. Better to use the indent code block icon ({} or Ctrl+K) – Anthon Nov 20 '16 at 16:06
  • You could do a find -type l to create an exclude list in a file and pass that to rsync --exclude-from. – meuh Nov 20 '16 at 19:16

man rsync:

  -q, --quiet
          This  option  decreases  the amount of information you are given
          during the transfer, notably  suppressing  information  messages
          from  the  remote  server.  This  option is useful when invoking
          rsync from cron.
| improve this answer | |
  • Thanks. I did not think of this myself. It would be nice to have a method that only cancels the "skipping non-regular file" messages. However, this works fine. – cdcotton Nov 22 '16 at 0:40
  • 1
    rsync is opensource, feel free to comment out one line. – Ipor Sircer Nov 22 '16 at 4:00

You could use

rsync | grep -v "skipping non-regular file"
| improve this answer | |
  • assuming rsync sends the message to stdout – Jeff Schaller Oct 6 '17 at 20:19
  • since this message is sent to stdout, we do not need that assumption – user175477 Oct 8 '17 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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