title: Mass renaming of randomly named files without knowing their path
body: <p>Having an issue during mass renaming of files in a path.</p>
  
  <p>Here is my issue:
  I have a drive full of around 16000 or more files (all images, but might be .psd, .jpg, .ai, .png, etc) scattered around in a very messy way, but the filenames are thankfully all unique, but due to the sheer amount, I cant say that's for sure (i mean there might be 2 files named abc.ai or the equivalent, but not many). I cannot know the path, since the csv provided only contains the original filenames, and what they should be renamed to.</p>
  
  <p>Basically, the first line in the csv is something like:</p>
  
  <blockquote>
    <p>qwerty.jpg, asdfg.jpg</p>
  </blockquote>
  
  <p>or </p>
  
  <blockquote>
    <p>123-asd_qwe.ai, abcfgd.ai.</p>
  </blockquote>
  
  <p>I did try several solutions I found; sed, some scripts, anything I could try I really did.</p>
  
  <p>I would really love to hear propositions or ideas or even a solution!</p>
  
  <p>To note: i tried ::</p>
  
  <pre><code>sed 's/"//g' names.csv | while IFS=, read orig new; do echo mv "$orig" "$new"; done
  </code></pre>
  
  <p>and</p>
  
  <pre><code>sed 's/^/mv -i -v "/;s/, /" "/;s/$/";/' &lt; names.csv | bash -
  </code></pre>
  
  <p>and</p>
  
  <pre><code>#!/bin/bash
   while read line          
   do          
        OldImageName=${line%,*}
        NewImageName=${line#*,}
        mv "$OldImageName" "$NewImageName"
   done &lt;"names.csv"
  </code></pre>