title: Change file extensions of multiple files in a directory with terminal/bash?
body: <p>I'm developing a simple launchdaemon that copies files from one directory to another. I've gotten the files to transfer over fine.</p>
  
  <p>I just want the files in the directory to be .mp3's instead of .dat's</p>
  
  <p>Some of the files look like this: </p>
  
  <blockquote>
    <p>6546785.8786.dat<br>
    3678685.9834.dat<br>
    4658679.4375.dat    </p>
  </blockquote>
  
  <p>I want them to look like this: </p>
  
  <blockquote>
    <p>6546785.8786.mp3<br>
    3678685.9834.mp3<br>
    4658679.4375.mp3    </p>
  </blockquote>
  
  <p>This is what I have at the end of the bash script to rename the file extensions.</p>
  
  <pre><code>cd $mp3_dir
  mv *.dat *.mp3
  exit 0
  </code></pre>
  
  <p>Problem is the file comes out as *.mp3 instead of 6546785.8786.mp3</p>
  
  <p>and when another 6546785.8786.dat file is imported to $mp3_dir, the *.mp3 is overwritten with the new .mp3</p>
  
  <p>I need to rename <strong>just</strong> the .dat file extensions to .mp3 and keep the filename. </p>
  
  <p>Ideas? Suggestions?</p>