Velvet Star Monitor

Standout celebrity highlights with iconic style.

updates

rsync error when excluding directory: "Unexpected remote arg"

Writer Mia Lopez

I'm attempting to sync remote files to a local directory. The following command works for me:

rsync -avz [email protected]:/remote/path/ /local/path

It asks for my password, I enter it, and it starts downloading/syncing files.

If I try and exclude a directory, however...

rsync -avz —-exclude='remote/dir' [email protected]:/remote/path/ /local/path

...it throws the following error:

Unexpected remote arg: [email protected]:/remote/path/
rsync error: syntax or usage error (code 1) at main.c(1372) [sender=3.1.3]

1 Answer

As you can see in this website about rsync usage, you can exclude a specific directory by typing:

rsync -a --exclude 'dir1' src_directory/ dst_directory/

Substitute your command from:

rsync -avz --exclude='remote/dir' [email protected]:/path/ /local/path

To this one:

rsync -avz --exclude 'dir' [email protected]:/home/user/dir /place_to_sync_on_local_machine/

Make sure you're not typing the whole address in the --exclude flag. Just the directory you wanted to exclude. It should work without problems.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.