Skip to content

core:rsync

Rsync Drupal code or files to/from another server using ssh.

Examples

  • drush rsync @dev @stage. Rsync Drupal root from Drush alias dev to the alias stage.
  • drush rsync ./ @stage:%files/img. Rsync all files in the current directory to the imgdirectory in the file storage folder on the Drush alias stage.
  • drush rsync @dev @stage -- --exclude=*.sql --delete. Rsync Drupal root from the Drush alias dev to the alias stage, excluding all .sql files and delete all files on the destination that are no longer on the source.
  • drush rsync @dev @stage --ssh-options="-o StrictHostKeyChecking=no" -- --delete. Customize how rsync connects with remote host via SSH. rsync options like --delete are placed after a --.

Arguments

  • source. A site alias and optional path. See rsync documentation and Site aliases.
  • target. A site alias and optional path. See rsync documentation and Site aliases.
  • [extra].... Additional parameters after the ssh statement.

Options

  • --exclude-paths=EXCLUDE-PATHS. List of paths to exclude, seperated by : (Unix-based systems) or ; (Windows).
  • --include-paths=INCLUDE-PATHS. List of paths to include, seperated by : (Unix-based systems) or ; (Windows).
  • --mode[=MODE]. The unary flags to pass to rsync; --mode=rultz implies rsync -rultz. Default is -akz. [default: akz]
  • --ssh-options=SSH-OPTIONS. A string appended to ssh command during rsync, sql-sync, etc.

Global Options

  • -v|vv|vvv, --verbose. Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
  • -y, --yes. Auto-accept the default for all user prompts. Equivalent to --no-interaction.
  • -l, --uri=URI. A base URL for building links and selecting a multi-site. Defaults to https://default.
  • To see all global options, run drush topic and pick the first choice.

Topics

Aliases

  • rsync
  • core-rsync

Legend

  • An argument or option with square brackets is optional.
  • Any default value is listed at end of arg/option description.
  • An ellipsis indicates that an argument accepts multiple values separated by a space.