title: Using Bash to replace DOTS or characters in DIRECTORY / SUBDIRECTORY names
body: <p>I have searched looking for the right solution. I have found some close examples.<a href="https://stackoverflow.com/a/2709619/3818865">Bash script to replace spaces in file names</a>
  But what I'm looking for is how to replace multiple <code>.</code>dots in current DIRECTORY/SUBDIRECTORY names, then replace multiple <code>.</code>dots in FILENAMES excluding the *.extention "recursively".</p>
  
  <p>This example is close but not right:</p>
  
  <pre><code>find . -maxdepth 2 -name "*.*" -execdir rename 's/./-/g' "{}" \;
  </code></pre>
  
  <p>another example but not right either:</p>
  
  <pre><code>for f in *; do mv "$f" "${f//./-}"; done
  </code></pre>
  
  <p>So  </p>
  
  <blockquote>
    <p>dir.dir.dir/dir.dir.dir/file.file.file.ext</p>
  </blockquote>
  
  <p>Would become </p>
  
  <blockquote>
    <p>dir-dir-dir/dir-dir-dir/file-file-file.ext</p>
  </blockquote>