I want to rsync content from a remote host to my laptop through ssh.
There are files I want to exclude, and in the remote host, there is a file called ".rsyncexclude" that specifies what I want to exclude.

So I run the following command:

rsync -av --progress --delete --exclude-from='username@example.com:remote/path/to/folder/to/sync/.rsyncignore' --delete-excluded username@example.com:remote/path/to/folder/to/sync/ local/path/to/folder/to/sync/

But I get the following error:

rsync: failed to open exclude file username@example.com:remote/path/to/folder/to/sync/.rsyncignore: No such file or directory (2)

Is there anything I'm doing wrong?


The --exclude-from option specifies a file that the local rsync process should read to add to the exclude list. It does not support the notation you used to read the file from the remote host; it interprets the filename as a path to a local file, which is why you are getting the error failed to open exclude file username@example.com:remote/path/to/folder/to/sync/.rsyncignore as it's trying to open exactly that file.

I don't think that there is a way to do what you want, short of first transferring the .rsyncignore file to the local host and then referencing that file via the --exclude-from option.

You may be helped by using the -F option, that specifies a per-directory file .rsync-filter that gets read on the source side.

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.