title: Error Trying To Make Easier rsync Command
body: <p>I normally use scp to copy stuff, but now I'm trying to get used to the more powerful rsync command. It helps me use less bandwidth by copying up only files that have changed. However, rsync has a lot of complex parameters, so I thought, hey, I'll just make a little Bash script that makes it easy for me, and call the command 'rscp'. So, off I went building something like this. Note in the example below that my web host uses a different port number besides 22, so that's why the $1 is used for that.</p>
  
  <pre><code>#!/bin/bash
  
  rsync -avzp --progress --rsh='ssh -p$1' $2 $3 $4 $5 $6 $7
  </code></pre>
  
  <p>So, its usage, I hoped, would be something like:</p>
  
  <pre><code>rscp 3822 --exclude=tiny_mce /var/www/mysite/* root@webhost.com:~/www/mysite
  </code></pre>
  
  <p>That would make it a little bit closer to my usage of the scp command, you see.</p>
  
  <p>However, when I ran this, I get this error:</p>
  
  <pre><code>building file list ... 
  4 files to consider
  ERROR: destination must be a directory when copying more than 1 file
  rsync error: errors selecting input/output files, dirs (code 3) at main.c(494) [receiver=2.6.9]
  rsync: connection unexpectedly closed (8 bytes received so far) [sender]
  rsync error: error in rsync protocol data stream (code 12) at io.c(454) [sender=2.6.9]
  </code></pre>
  
  <p>But if I go back to the regular rsync command, it works just fine.</p>
  
  <p>Can anyone figure out what I'm doing wrong in my Bash script?</p>