Rsync Error When Excluding Directory: "Unexpected Remote Arg"
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...
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.