title: BASH Linux - How to pass the result of find into a mv destination via echo
body: <p>I have a directory which is filled with PDFS that were uploaded by a user and that didnt realize that certain naming conventions needed to be followed to have the files be downloadable again. To fix the issue en mass, I need to run a bash script or command that will recursively spider through the subdirectories and strip out the bad characters and rename the files. </p>
  
  <p>I thought I had it all figured out, but alas, I am stuck on one part. Once I run my command (see below) I get a host of errors showing its finding the files, but the argument list for move (the destination) isnt being set properly. How do I pass the filename into the sub-command?</p>
  
  <pre><code>find . -name '*.pdf' -or -name '*.PDF' -execdir mv -v '{}' `echo {} | tr ' ' '_' | tr -d '[{}(),\!]' | tr -d "\'" | tr '[A-Z]' '[a-z]' | sed 's/_-_/_/g'`\;
  </code></pre>
  
  <p>I know my issue is the echo {} thing, but I have no idea how to get the filename found by find in there. The first substitution works, the echo one doesnt.</p>
  
  <p>Thanks in advance!</p>