With a little for loop and some magical sed, I was able to figure out a quick line to help me
rename all the files in a specific folder that have characters I don’t want there.

This line will look at all the .jpg’s in the current directory and rename them taking out any instance of “( ” and replacing it with ” – “. I’m sure you can figure out how to tailor this to your liking by editing the type of file extension and putting in your own sed statements.

<pre class="wp-code-highlight prettyprint">for file in *.jpg; do mv "$file" "$(echo "$file" | sed s/\ \(/\ -\ /g)"; done</pre><p></p>

Nice huh.?

Mario Loria is a builder of diverse infrastructure with modern workloads on both bare-metal and cloud platforms. He's traversed roles in system administration, network engineering, and DevOps. You can learn more about him here.