Answers.Body: <p>I use <code>rsync</code> with <a href="http://gruntjs.com/">grunt</a>. There is a <a href="https://github.com/jedrichards/grunt-rsync">grunt rsync task</a>, which is just a wrapper for raw rsync. If all I used grunt for was the rsync I don't think it would be worth it, but I use it to compile my sass, and to reload my browser (<a href="https://github.com/gruntjs/grunt-contrib-sass">grunt-contrib-sass</a>, <a href="https://github.com/gruntjs/grunt-contrib-watch">grunt-contrib-watch</a>) among other things.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-27T11:16:13.797Z
Answers.Text: Fantastic. This is really helpful. Thanks!
Answers.UserDisplayName: Matt Stauffer
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-27T16:45:07.837Z
Answers.Text: I think of rsync as a really sharp knife - super useful, but it will cut...
Answers.UserDisplayName: Marion Newlevant
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-27T05:18:31.613Z
Answers.LastActivityDate: 2014-07-27T05:18:31.613Z
Answers.UserDisplayName: Marion Newlevant
Answers.Body: <p>Another alternative to grunt is to use <a href="http://gulpjs.com/">http://gulpjs.com/</a>. This is what I use for minifying css js and assets etc. I've been meaning to setup a way of syncing folders so I've put together gulp task to do it. I have roughly tested it but you might want to look over the code before you use it on a production site :) Be aware that it is setup to sync the folder so it will remove any local files that are not present on your staging/production server.</p>
  
  <p>To use gulp you need to have node.js installed with npm. First install gulp globally:</p>
  
  <pre><code>npm install -g gulp
  </code></pre>
  
  <p>you might need to run that as sudo.</p>
  
  <p>Next, in the root of your craft project create a gulpfile.js that looks something like this:</p>
  
  <pre><code>// Gulp
  var gulp = require('gulp');
  
  // Plugins
  var rsync = require("rsyncwrapper").rsync;
  
  // Pull down assets and sync local folder
  gulp.task('synclocal', function(){
      rsync({
          src: "username@hostname.com:/path/to/assets",
          dest: "assets",
          ssh: true,
          recursive: true,
          syncDest: true,
          compareMode: "checksum"
      },function (error,stdout,stderr,cmd) {
          if ( error ) {
              // failed
              console.log(error.message);
          } else {
              // success
              console.log("folder synced!")
          }
      });
  });
  </code></pre>
  
  <p>Finally we need to make sure rsyncwrapper is install. You can do this by running:</p>
  
  <pre><code>npm install rsyncwrapper
  </code></pre>
  
  <p>You should now be able to run the task by typing:</p>
  
  <pre><code>gulp synclocal
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-27T11:15:39.353Z
Answers.Text: Brilliant! Great idea!
Answers.UserDisplayName: Matt Stauffer
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-27T06:30:49.643Z
Answers.LastActivityDate: 2014-07-27T06:30:49.643Z
Answers.UserDisplayName: Dave Coggins
Answers.Body: <p>I think this might be the plugin you are looking for: </p>
  
  <p><a href="https://github.com/boboldehampsink/zipassets" rel="nofollow">https://github.com/boboldehampsink/zipassets</a></p>
  
  <p>It allows you to download a zip of selected assets, might be easy to specify all assets within the plugin.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-26T01:44:31.917Z
Answers.Text: Hm, maybe hooking that up to a "get all asset IDs" request and then making it a control panel button might be the ticket--thanks! I'll take a look further into it.
Answers.UserDisplayName: Matt Stauffer
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-26T01:46:22.977Z
Answers.Text: Would love to see what you end up doing! You are referring to local assets and not S3 correct?
Answers.UserDisplayName: Jason McCallister
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-26T01:46:51.030Z
Answers.Text: Yep, just for local assets at the moment.
Answers.UserDisplayName: Matt Stauffer
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-26T01:34:44.347Z
Answers.LastActivityDate: 2014-07-26T01:34:44.347Z
Answers.UserDisplayName: Jason McCallister
Answers.Body: <p>You might want to take a look at capistrano if your looking at ways to automate sync mutliple environments:</p>
  
  <p><a href="http://capistranorb.com/" rel="nofollow">http://capistranorb.com/</a></p>
  
  <p>Not sure what your local environment is like but if you have ruby installed, capistrano might be be something to consider for automation. There are plenty examples across the web of how to use it to sync databases and folders. It used to be heavily tied to rails app but as of recent versions I believe it is more agnostic. I know I'll be looking into this in the coming weeks once I get some spare time.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-27T00:44:06.280Z
Answers.Text: Thanks Dave! I've been itching to learn Capistrano for a while. I'd prefer an option that doesn't require Ruby so we had a community wide standard method, but this is definitely a route to go for more complex needs. Thanks!!
Answers.UserDisplayName: Matt Stauffer
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-27T02:49:43.553Z
Answers.Text: Hi Matt, if you'd prefer php take a look at http://deployer.in/ I haven't tried it myself but it looks promising. I'm sure there is another one I stumbled across a while ago but I can't seem to find it. I'll let you know if I do though.
Answers.UserDisplayName: Dave Coggins
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-26T06:15:52.417Z
Answers.LastActivityDate: 2014-07-26T06:15:52.417Z
Answers.UserDisplayName: Dave Coggins
Answers.Body: <p>Just updating this thread with another option. Also using Rsync but through the Mac app Dropsync3 <a href="http://mudflatsoftware.com/" rel="nofollow">http://mudflatsoftware.com/</a></p>
  
  <p>Pretty cool, I'm currently getting the "dump" plugin to make a daily db backup via Cron and then getting Dropsync to sync the "storage" folder with a folder on my computer (that is version controlled).</p>
  
  <p>Also doing similarly with assets and just debating the best way to handle system updates.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-03T10:08:26.397Z
Answers.LastActivityDate: 2016-05-03T10:08:26.397Z
Answers.UserDisplayName: André Goldstein
Answers.Body: <p>In case it's of use to anyone coming to this thread, I maintain a project called <a href="https://github.com/niceandserious/crafty-vagrant" rel="nofollow">Crafty Vagrant</a>, which is intended to be a handy dev environment / boilerplate starting point for Craft projects, and which has (among other things) both asset-syncing, in the form of a Gulp task (eg. <code>gulp rsync:fromstage</code>), and simplified database provisioning (<code>vagrant provision --provision-with shell</code> drops the current local database and replaces it with the most recent backup from Craft's backups directory).</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-13T13:44:11.417Z
Answers.LastActivityDate: 2016-05-13T13:44:11.417Z
Answers.UserDisplayName: Nick F
Answers.Body: <p>I made a simple script to do this. It's much, much less powerful than Capistrano, but with a few tweaks I think it'll be more flexible (for starters, not requiring Ruby or learning Cap).</p>
  
  <p><a href="https://github.com/mattstauffer/syncCraft" rel="nofollow">https://github.com/mattstauffer/syncCraft</a></p>
  
  <p><strong>My Original solution, pre-syncCraft:</strong></p>
  
  <p>FYI, this is what I'm doing right now. It's not good enough, but I'll put it up for reference... I run this from the command line:</p>
  
  <pre><code>scp myuser@myhost:/path/to/site/public/assets/images/content/* /local/path/to/site/public/assets/images/content/
  </code></pre>
  
  <p>But it's manual, and not smart enough to avoid overwriting stuff locally. I think I could use <code>rsync</code> to avoid overwriting locally, but again, I feel like a Craft plugin might(?) be a better option.</p>
  
  <p>Here's the <code>rsync</code> version:</p>
  
  <pre><code>rsync -auv myuser@myhost:/path/to/site/public/assets/images/content/* /local/path/to/site/public/assets/images/content/
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-26T01:47:40.340Z
Answers.Text: Probably depends on how many Assets you'll be pulling down.  If it's gigs and gigs, you'll bump into memory and execution time limits with PHP.  Something like rsync (even if triggered from PHP), might be more reliable then.
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-26T01:49:07.977Z
Answers.Text: Ahhh--ok, good thought. I'll probably try an rsync-based version, and just do my best to make it as simple to install as possible (trying to get the workflow so simple that it's not a huge pain to add to a new site).
Answers.UserDisplayName: Matt Stauffer
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-26T01:58:55.723Z
Answers.Text: OK, rsync version is a ton better, but it's still super manual to add it. Might have to make something happen.
Answers.UserDisplayName: Matt Stauffer
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-26T02:00:12.660Z
Answers.Text: If you've got a script that handles the other stuff (pulling db down, nuking local, reinstalling), why not have the script trigger rsync?
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-26T02:01:38.117Z
Answers.Text: I don't. I do the rest manually now. But I think this is my motivation to throw it all into a script. There wouldn't be an easy method I could run from my shell script to trigger a backup, would there? :hopeful: :)
Answers.UserDisplayName: Matt Stauffer
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-26T02:03:54.880Z
Answers.Text: From a shell script?  Probably mysqldump (https://dev.mysql.com/doc/refman/5.1/en/backup-methods.html). If it were a plugin you could use craft()->db->backup().
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-26T01:43:47.450Z
Answers.LastActivityDate: 2014-07-27T17:18:32.960Z
Answers.LastEditDate: 2014-07-27T17:18:32.960Z
Answers.UserDisplayName: Matt Stauffer
Body: <p>I'm trying to speed up the process of synchronizing my production site down to my local install. Currently, it is: Back up database, wipe local database, import database backup. It's not perfect, but it is pretty fast.</p>
  
  <p>But synchronizing the assets down is still a pain. Is there a process or plugin that makes it easy/easier to synchronize assets (uploaded photos, etc.) between installs?</p>
  
Tags: <assets>
Title: Is there an easy way to download the assets directory to a local install?
ThreadText: # Is there an easy way to download the assets directory to a local install?
  
  (Asked by: username_0 on 2014-07-26)
  
  I'm trying to speed up the process of synchronizing my production site down to my local install. Currently, it is: Back up database, wipe local database, import database backup. It's not perfect, but it is pretty fast.
  
  But synchronizing the assets down is still a pain. Is there a process or plugin that makes it easy/easier to synchronize assets (uploaded photos, etc.) between installs?
  
  **Tags:** assets
  
  
  ---
  
  ## 7 answers
  
  ### Answer by username_0 on 2014-07-26. Score: 7 | Accepted answer
  
  I made a simple script to do this. It's much, much less powerful than Capistrano, but with a few tweaks I think it'll be more flexible (for starters, not requiring Ruby or learning Cap).
  
  <https://github.com/username_0/syncCraft>
  
  **My Original solution, pre-syncCraft:**
  
  FYI, this is what I'm doing right now. It's not good enough, but I'll put it up for reference... I run this from the command line:
  
  ```
  scp myuser@myhost:/path/to/site/public/assets/images/content/* /local/path/to/site/public/assets/images/content/
  
  ```
  
  But it's manual, and not smart enough to avoid overwriting stuff locally. I think I could use `rsync` to avoid overwriting locally, but again, I feel like a Craft plugin might(?) be a better option.
  
  Here's the `rsync` version:
  
  ```
  rsync -auv myuser@myhost:/path/to/site/public/assets/images/content/* /local/path/to/site/public/assets/images/content/
  
  ```
  
  > **Comments:**
  > **username_6**: Probably depends on how many Assets you'll be pulling down.  If it's gigs and gigs, you'll bump into memory and execution time limits with PHP.  Something like rsync (even if triggered from PHP), might be more reliable then.  
  > **username_0**: Ahhh--ok, good thought. I'll probably try an rsync-based version, and just do my best to make it as simple to install as possible (trying to get the workflow so simple that it's not a huge pain to add to a new site).  
  > **username_0**: OK, rsync version is a ton better, but it's still super manual to add it. Might have to make something happen.  
  > **username_6**: If you've got a script that handles the other stuff (pulling db down, nuking local, reinstalling), why not have the script trigger rsync?  
  > **username_0**: I don't. I do the rest manually now. But I think this is my motivation to throw it all into a script. There wouldn't be an easy method I could run from my shell script to trigger a backup, would there? :hopeful: :)  
  > **username_6**: From a shell script?  Probably mysqldump (https://dev.mysql.com/doc/refman/5.1/en/backup-methods.html). If it were a plugin you could use craft()->db->backup().  
  
  ---
  
  ### Answer by username_1 on 2014-07-27. Score: 8
  
  I use `rsync` with [grunt](http://gruntjs.com/). There is a [grunt rsync task](https://github.com/jedrichards/grunt-rsync), which is just a wrapper for raw rsync. If all I used grunt for was the rsync I don't think it would be worth it, but I use it to compile my sass, and to reload my browser ([grunt-contrib-sass](https://github.com/gruntjs/grunt-contrib-sass), [grunt-contrib-watch](https://github.com/gruntjs/grunt-contrib-watch)) among other things.
  
  > **Comments:**
  > **username_0**: Fantastic. This is really helpful. Thanks!  
  > **username_1**: I think of rsync as a really sharp knife - super useful, but it will cut...  
  
  ---
  
  ### Answer by username_2 on 2014-07-27. Score: 7
  
  Another alternative to grunt is to use <http://gulpjs.com/>. This is what I use for minifying css js and assets etc. I've been meaning to setup a way of syncing folders so I've put together gulp task to do it. I have roughly tested it but you might want to look over the code before you use it on a production site :) Be aware that it is setup to sync the folder so it will remove any local files that are not present on your staging/production server.
  
  To use gulp you need to have node.js installed with npm. First install gulp globally:
  
  ```
  npm install -g gulp
  
  ```
  
  you might need to run that as sudo.
  
  Next, in the root of your craft project create a gulpfile.js that looks something like this:
  
  ```
  // Gulp
  var gulp = require('gulp');
  
  // Plugins
  var rsync = require("rsyncwrapper").rsync;
  
  // Pull down assets and sync local folder
  gulp.task('synclocal', function(){
      rsync({
          src: "username@hostname.com:/path/to/assets",
          dest: "assets",
          ssh: true,
          recursive: true,
          syncDest: true,
          compareMode: "checksum"
      },function (error,stdout,stderr,cmd) {
          if ( error ) {
              // failed
              console.log(error.message);
          } else {
              // success
              console.log("folder synced!")
          }
      });
  });
  
  ```
  
  Finally we need to make sure rsyncwrapper is install. You can do this by running:
  
  ```
  npm install rsyncwrapper
  
  ```
  
  You should now be able to run the task by typing:
  
  ```
  gulp synclocal
  
  ```
  
  > **Comments:**
  > **username_0**: Brilliant! Great idea!  
  
  ---
  
  ### Answer by username_3 on 2014-07-26. Score: 4
  
  I think this might be the plugin you are looking for:
  
  <https://github.com/boboldehampsink/zipassets>
  
  It allows you to download a zip of selected assets, might be easy to specify all assets within the plugin.
  
  > **Comments:**
  > **username_0**: Hm, maybe hooking that up to a "get all asset IDs" request and then making it a control panel button might be the ticket--thanks! I'll take a look further into it.  
  > **username_3**: Would love to see what you end up doing! You are referring to local assets and not S3 correct?  
  > **username_0**: Yep, just for local assets at the moment.  
  
  ---
  
  ### Answer by username_2 on 2014-07-26. Score: 4
  
  You might want to take a look at capistrano if your looking at ways to automate sync mutliple environments:
  
  <http://capistranorb.com/>
  
  Not sure what your local environment is like but if you have ruby installed, capistrano might be be something to consider for automation. There are plenty examples across the web of how to use it to sync databases and folders. It used to be heavily tied to rails app but as of recent versions I believe it is more agnostic. I know I'll be looking into this in the coming weeks once I get some spare time.
  
  > **Comments:**
  > **username_0**: Thanks username_2! I've been itching to learn Capistrano for a while. I'd prefer an option that doesn't require Ruby so we had a community wide standard method, but this is definitely a route to go for more complex needs. Thanks!!  
  > **username_2**: Hi username_0, if you'd prefer php take a look at http://deployer.in/ I haven't tried it myself but it looks promising. I'm sure there is another one I stumbled across a while ago but I can't seem to find it. I'll let you know if I do though.  
  
  ---
  
  ### Answer by username_4 on 2016-05-03. Score: 3
  
  Just updating this thread with another option. Also using Rsync but through the Mac app Dropsync3 <http://mudflatsoftware.com/>
  
  Pretty cool, I'm currently getting the "dump" plugin to make a daily db backup via Cron and then getting Dropsync to sync the "storage" folder with a folder on my computer (that is version controlled).
  
  Also doing similarly with assets and just debating the best way to handle system updates.
  
  
  ---
  
  ### Answer by username_5 on 2016-05-13. Score: 1
  
  In case it's of use to anyone coming to this thread, I maintain a project called [Crafty Vagrant](https://github.com/niceandserious/crafty-vagrant), which is intended to be a handy dev environment / boilerplate starting point for Craft projects, and which has (among other things) both asset-syncing, in the form of a Gulp task (eg. `gulp rsync:fromstage`), and simplified database provisioning (`vagrant provision --provision-with shell` drops the current local database and replaces it with the most recent backup from Craft's backups directory).
  
  
  ---
  
  