I'm executing a command like the following to several different systems:

$ rsync -a -v [email protected]:'/path/to/first/*.log path/to/second.txt' /dest/folder/0007/.

Sometimes *.log does not exist, and that's OK, but rsync generates the following error:

receiving file list ... rsync: link_stat "/path/to/first/*.log" failed: No such file or directory (2)

Is there any way to suppress that? The only way I can think of is to use include and exclude filters, which just seem a PITA to me. Thanks!

2 Answers 2


I think the answer to the question is best described in this answer:



Unfortunately, only later versions have this functionality. I am running RHEL 7 with rsync 3.0.9, which does not seem to have this option.


To clarify, you would just like to not 'see' the error? For that case you could just redirect the Standard Error Output, but you may end up missing a more serious error that you might want to know of.

Redirect Error Output Example

rsync -a -v [email protected]:'/path/to/first/*.log path/to/second.txt' /dest/folder/0007/ 2>/dev/null

If instead you are looking to only miss the error on a file that doesn't exist, you can't change the rsync *.log filter and you want to avoid using includes, you could wrap it in a script to proceed based on the condition.

Script Example

# Script to Handle Rsync based on Log File Existence
if [ "$(ls -A /path/to/first/*.log > /dev/null > 2&1)" ]; then
     # Log Exists Use This Rsync
    rsync -a -v [email protected]:'/path/to/first/*.log path/to/second.txt' /dest/folder/0007/
    # Log Does Not Exist Use This Rsync
    rsync -a -v foo@machine.company.com:'path/to/second.txt' /dest/folder/0007/

Hope I was some help.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .