drush core-rsync

Rsync the Drupal tree to/from another server using ssh.

Drush Command

drush core-rsync

Arguments

source : May be rsync path or site alias. See rsync documentation and example.aliases.drushrc.php.
destination : May be rsync path or site alias. See rsync documentation and example.aliases.drushrc.php.

Aliases

drush rsync

Options

--mode : The unary flags to pass to rsync; --mode=rultz implies rsync -rultz.  Default is -akz.
--exclude-conf : Excludes settings.php from being rsynced.  Default.
--include-conf : Allow settings.php to be rsynced. Default is to exclude settings.php.
--include-vcs : Include special version control directories (e.g. .svn).  Default is to exclude vcs files.
--exclude-files : Exclude the files directory.
--exclude-sites : Exclude all directories in "sites/" except for "sites/all".
--exclude-other-sites : Exclude all directories in "sites/" except for "sites/all" and the site directory for the site being synced.  Note: if the site directory is different between the source and destination, use --exclude-sites followed by "drush rsync @from:%site @to:%site"
--exclude-paths : List of paths to exclude, seperated by : (Unix-based systems) or ; (Windows).
--include-paths : List of paths to include, seperated by : (Unix-based systems) or ; (Windows).
--{rsync-option-name} : Replace {rsync-option-name} with the rsync option (or option='value') that you would like to pass through to rsync. Examples include --delete, --exclude=*.sql, --filter='merge /etc/rsync/default.rules', etc. See the rsync documentation for a complete explanation of all the rsync options and values.
--rsync-version : Set to the version of rsync you are using to signal Drush to go into backwards-compatibility mode when using very old versions of rsync. For example, --rsync-version=2.6.8 or earlier will cause Drush to avoid the --remove-source-files flag.

Examples

Rsync Drupal root from Drush alias dev to the alias stage. Either or both may be remote.

drush rsync @dev @stage
Rsync all files in the current directory to the 'img' directory in the file storage folder on the Drush alias stage.
drush rsync ./ @stage:%files/img
Simulate Rsync Drupal root from the Drush alias dev to the alias stage (one of which must be local), excluding all files that match the filter '.sql' and delete all files on the destination that are no longer on the source.
drush -s rsync @dev @stage --exclude=.sql --delete