title: clean shared/assets folder on production server rails 3
body: <p>I have my assets on production server on <code>/home/name/apps/myapp/shared/assets"</code></p>
  
  <p>I'm seeing as this directory is growing quickly. Now the weight folder is 40 Mb but my current assets have weight of 3.2 mb</p>
  
  <p><strong>My question is how can I clean this folder of old assets with a capistrano custom task. I only need the last assets when I make the last <code>cap deploy</code></strong></p>
  
  <p>Edited:</p>
  
  <p>Capistrano task for precompile:</p>
  
  <pre><code>namespace :assets do
      task :precompile, :roles =&gt; :web, :except =&gt; { :no_release =&gt; true } do
        from = source.next_revision(current_revision)
        if capture("cd #{latest_release} &amp;&amp; #{source.local.log(from)} vendor/assets/ app/assets/ | wc -l").to_i &gt; 0
          run_locally("rm -rf public/assets/*") 
          run_locally "bundle exec rake assets:precompile"
          find_servers_for_task(current_task).each do |server|
           run_locally "rsync -vr --exclude='.DS_Store' --recursive --times --rsh=ssh --compress --human-readable --progress public/assets #{user}@#{server.host}:#{shared_path}/"
          end
        else
          puts.info "Skipping asset pre-compilation because there were no asset changes"
        end
      end
    end
  </code></pre>
  
  <p>I was precompiled asset on production server but I have changed to precompile asset to local machine with rsync.</p>