title: Renaming and Moving Files in Bash or Perl
body: <p>HI, I'm completely new to Bash and StackOverflow.</p>
  
  <p>I need to move a set of files (all contained in the same folder) to a target folder where files with the same name could already exist.</p>
  
  <p>In case a specific file exists, I need to rename the file before moving it, by appending for example an incremental integer to the file name.</p>
  
  <p>The extensions should be preserved (in other words, that appended incremental integer should go <strong>before</strong> the extension). The file names could contain dots in the middle.</p>
  
  <p>Originally, I was thinking about comparing the two folders to have a list of the existing files (I did this with "comm"), but then I got a bit stuck. I think I'm just trying to do things in the most complicated possible way.</p>
  
  <p>Any hint to do this in the "bash way"? It's OK if it is done in a script other than bash script.</p>