Configuring drush alias for rsync with exclude paths and file patterns I tried adding exclude paths and file patterns to my drush alias; it didn't work, but adding the filters with --exclude= in the command works.

drush rsync --exclude=imagecache/* --exclude=ctools/* --exclude=js/* --exclude=tmp/* --exclude=xmlsitemap/* --exclude=*.doc* --exclude=*.DOC* --exclude=*.pdf* --exclude=*.PDF* --exclude=*.ppt* --exclude=*.PPT* --exclude=*.zip --exclude=*.ZIP --exclude=*.xls* --exclude=*.XLS* @sitename.live:%files @sitename.local:%files


(I wanted to create the directories but skip the contents)

I looked at a similar question but I'm not sure what I am doing wrong.

The docs for drush core-rsync explain:


  --exclude-paths List of paths to exclude, seperated by : (Unix-based systems) or ; (Windows).


here is what I tried:

$aliases['live'] = array(
  'root' =&gt; '/var/www/[domain]/htdocs',
  'uri' =&gt; '[site uri]',
  'remote-host' =&gt; '[host ip]',
  'remote-user' =&gt; 'rgoya',
  'path-aliases' =&gt; array(
    '%files' =&gt; 'sites/default/files',
  ),
  'command-specific' =&gt; array(
        'sql-sync' =&gt; array(
            'no-cache' =&gt; TRUE,      
        ),
        'rsync' =&gt; array (
            'mode' =&gt; 'rlptDz',
            'exclude-paths' =&gt; 'css:imagecache:ctools:js:tmp::xmlsitemap',
            'exclude' =&gt; '*.tmp',
            'exclude' =&gt; '*.doc*',
            'exclude' =&gt; '*.zip',
            'exclude' =&gt; '*.xls*',
        ),
    ), 
);


I also tried 'mode' => 'azv'

Also, can I use regexp in the exclude patterns? some extensions are lowercase, some are uppercase .pdf / .PDF
Your subsequent 'exclude' items in the PHP array are overwriting their previous ones, so the example above only has --exclude=xls

drush help rsync does not explicitly document the syntax for --exclude but I assume that it's similar to --explude-path and that would mean you should do something like this:

'rsync' =&gt; array (
  'mode' =&gt; 'rlptDz',
  'exclude-paths' =&gt; 'css:imagecache:ctools:js:tmp::xmlsitemap',
  'exclude' =&gt; '*.tmp:*.doc*:*.zip:*.xls*',
),


EDIT: looking into the example.aliases.drushrc.php there is this tip included:

// if you need multiple exludes, use an rsync exclude file
'exclude-from' =&gt; "'/etc/rsync/exclude.rules'",


That's maybe the best way to go.