title: How do I move the oldest or newest file in a directory to another with Mac OS X Terminal
body: <p>I'm trying to us the following command on Mac OSX 10.6 Terminal but it does not work..Any idea what I may be doing wrong?</p>
  
  <p>These work...</p>
  
  <p><strong>List most recent file:</strong></p>
  
  <pre><code>ls -l -t | head -2
  </code></pre>
  
  <p><strong>List oldest file:</strong></p>
  
  <pre><code>$ ls -gt | tail -1
  </code></pre>
  
  <p>But when I try to <strong>Move the oldest file</strong>, with this it doesn't work:</p>
  
  <pre><code>mv `ls -tr |tail -1` newdirname
  </code></pre>
  
  <p>Any ideas or tips are appreciated!! And please be gentle guys, I'm not so good at this command line stuff yet ; )</p>
  
  <p>Thanks,</p>
  
  <p>Jess</p>
  
  <p>Ps. </p>
  
  <p>When I enter this: </p>
  
  <pre><code>mv `ls -tr |tail -1` DropBox
  </code></pre>
  
  <p>I get this: <code>mv: rename Test.txt to DropBox/Test.txt: No such file or directory</code></p>