drush examples for moving files around

As I move more sites from D7 to D9 and D10 I have been playing more and more with some drush commands to move the DBs and files around I thought I would capture some here to ensure they don't get lost.

To ensure only the necessary files are copied without any extraneous ones I found this in the drush manual (https://www.drush.org/12.x/site-aliases/):

  command:
    core:
      rsync:
        options:
          mode: rlptz
          exclude-paths: 'css:imagecache:ctools:js:tmp:php:styles'

Which looks a bit like something that could be deemed as a recommendation.

When transferring files between sites, back in the day, before I was using drush i would use:

rsync -rltDPh --exclude '*.tar.gz' --exclude 'files/js/js_*' --exclude 'files/css/css_*' --exclude 'files/imagecache/*' --exclude 'files/styles/*' --exclude 'files/php/*' --delete -e ssh ${SSH_URL}:${FILES_LOCATION} ${SYNC_FILES_LOCATION}

Where the variables passed to the rsync command were:
r –recursive, l –links, t -times, -D -preserve devices specials, v -verbose h -human-readable, P -partial -progress
or sometimes I also used:
-avz (a -archive (rlptgoD), v - verbose, z - gzip, -p -perms, g -group, o -owner

From the Drush manual pages it looks like drush are suggesting:
r –recursive, l –links, -p -perms, , t -times, z - gzip

Also my excludes missed a few folders that perhapsI could have been excluding too.

I could add the above to my drush alias, but I may just start using a drush command that looks like this:

drush -y rsync @source @target --exclude-paths="css:imagecache:ctools:js:tmp:php:styles" --mode=rlptz

Add new comment