title: BASH : Add a string to all file names in a folder
body: <p>I have a folder with several files :</p>
  
  <pre><code>1-1.csv
  1-2.csv
  2-1.csv
  </code></pre>
  
  <p>And I want to rename them this way :</p>
  
  <pre><code>1-1-hist.csv
  1-2-hist.csv
  2-1-hist.csv
  </code></pre>
  
  <p>Following <a href="https://stackoverflow.com/questions/7450818/rename-all-files-in-directory-from-filename-h-to-filename-half">this post</a> I tried the following :</p>
  
  <pre><code>for file in *.csv
  do
    mv "$file" "${file/.csv/-hist.csv}"
  done
  </code></pre>
  
  <p>But file names don't change and my terminal says :</p>
  
  <pre><code>mv: '1-1.csv' and '1-1.csv' are the same file
  mv: '1-2.csv' and '1-2.csv' are the same file
  mv: '2-1.csv' and '2-1.csv' are the same file
  </code></pre>
  
  <p>What am I doing wrong ?</p>
  
  <p><strong>EDIT :</strong></p>
  
  <pre><code>rename 's/.csv/-hist.csv/' *.csv
  </code></pre>
  
  <p>did the job. Even if I don't know what did not work in the first attempt...</p>