title: how to delete all files except the latest three in a folder
body: <p>I have a folder which contains some subversion revision checkouts (these are checked out when running a capistrano deployment recipe). </p>
  
  <p>what I want to do really is that to keep the latest 3 revisions which the capistrano script checkouts and delete other ones, so for this I am planning to run some command on the terminal using a run command, actually capistrano hasn't got anything to do here, but a unix command. </p>
  
  <p>I was trying to run a command to get a list of files except the lastest three and delete the rest, I could get the list of files using the following command.</p>
  
  <pre><code>(ls -t /var/path/to/folder |head -n 3; ls /var/path/to/folder)|sort|uniq -u|xargs
  </code></pre>
  
  <p>now if I add a rm -Rf to the end of this command it returns me with file not found to delete. so thats obvious because this returns only the name of the folder, not the full path to the folder.</p>
  
  <p>is there anyway to delete these files / folders using one unix command?</p>