Both drush and rsync are handy tools to automate the deployment of Drupal sites. You just have to be careful how you combine them.
In my development environment I have a local CVS checkout of drush and I use rsync to push that directory to the remote production server. This way I'm sure both development and production use the same version of drush without the need to install a CVS client on the production server.
Unfortunately my initial attempts to get drush running on the remote system always resulted in the following error message:
The command 'drush.php help' could not be found.
Initially I assumed there was something wrong with the path to the drush executable or the code that detects the location of the drush.php file but only after a while I found the real culprit.
To reduce the number of files that need to be synced I used rsync's --cvs-exclude option. This option makes rsync ignore certain files and directories in the same way CVS does. For example it will filter out all CVS directories. It turns out that a lot more files get excluded:
RCS SCCS CVS CVS.adm RCSLOG cvslog.* tags TAGS .make.state .nse_depinfo *~ #* .#* ,* _$* *$ *.old *.bak *.BAK *.orig *.rej .del-* *.a *.olb *.o *.obj *.so *.exe *.Z *.elc *.ln core .svn/ .git/ .bzr/
Notice core in that list? Guess in which directory drush keeps major parts of its code! By using the --cvs-exclude option of rsync, my remote drush directory was missing approximately 2500 lines of PHP code resulting in the bizarre error message.
The solution is to stop using the --cvs-exclude option or use the --filter option to tune the list of files to exclude during syncing.

8 Comments
drush sync command (IN HEAD)
Submitted by moshe weitzman on
drush sync command (IN HEAD) greatly simplifies rsync jobs like this. You can quickly push your drush install to a remote server or pull stuff down form remote to local. Docs coming soon.
sql sync command is similarly useful (HEAD only)
Thanks for the tips. To tell
Submitted by Rapidshare SE on
Thanks for the tips. To tell the truth I haven't heard about Drush! I'll try it!
The solution is to stop
Submitted by Jeux de moto on
The solution is to stop using the --cvs-exclude option or use the --filter option to tune the list of files to exclude during syncing.
We run couple of drupal
Submitted by mediafire search on
We run couple of drupal based sites for local furniture retailer. we always have large amounts of price lists files, so drush and rsync functions are quite useful in that case.
Thanks for sharing your experience on that.
I had the same problem, but
Submitted by icero on
I had the same problem, but I didnt bother to look into it due the lack of time. Accidently I ended up there looking for something else. When I have some time next week Ill give it a try.
So thanks for the tips and this page is bookmarked!
The solution is to stop
Submitted by gratta e vinci demo on
The solution is to stop using the --cvs-exclude option or use the --filter option to tune the list of files to exclude during syncing.
I'm agree with gratta, the
Submitted by Bingo on
I'm agree with gratta, the solution is to stop using te cvs exclude option.
I'm agree with all that
Submitted by crea sito web on
I'm agree with all that comments, i think is a great idea. thanks