- drush_tools_sync in contributions/drush_extras/tools.drush.inc
- Push files from or to the local Drupal install using SSH and RSync
contributions/drush_extras/tools.drush.inc, line 52
drush_tools_sync($source = DRUSH_DRUPAL_ROOT, $destination)drush_tools_sync($source, $destination)Push files from or to the local Drupal install using SSH and RSync
void
<?php
function drush_tools_sync($source, $destination) {
// Local paths are relative to Drupal root
if (!strstr($source, ':')) {
$source = DRUSH_DRUPAL_ROOT. "/$source";
}
if (!strstr($destination, ':')) {
$destination = DRUSH_DRUPAL_ROOT. "/$destination";
}
// Prompt for confirmation. This is destructive.
if (!DRUSH_SIMULATE) {
drush_print(dt("You will destroy data from !target and replace with data from !source", array('!source' => $source, '!target' => $destination)));
if (!drush_confirm(dt('Do you really want to continue?'))) {
drush_die('Aborting.');
}
}
$options = '-az';
$exec = "rsync -e ssh $options --exclude \"*.svn*\" $source $destination";
if (DRUSH_VERBOSE) {
// the drush_op() will be verbose about the command that gets executed.
$options .= 'v';
}
return drush_op('system', $exec) !== FALSE;
}
?>