How to Synchronize Files Between Different Environments

To download a single database dump from production to staging environment, you can use the unix scp command as follows:

1
2
$ scp <username>@<host>:~/path/to/production/backups/latest.sql \
/path/to/staging/backups/latest.sql

To download multiple media files from production to staging, you can use the unix rsync command as follows:

1
2
3
$ rsync --archive --compress --partial --progress \
<username>@<host>:/path/to/production-media-directory/ \
/path/to/staging-media-directory/

Tips and Tricks Dev Ops Bash