title: Rename files with function
body: <p>I would like to rename files in directory using bash. </p>
  
  <p>I am trying: </p>
  
  <pre><code>find . -type f -exec mv '{}' $(urlencode {})  \;
  </code></pre>
  
  <p>but urlencode encodes literally <code>{}</code> instead of taking result of find. </p>
  
  <p>If changed to: </p>
  
  <pre><code>. -type f -exec mv '{}' $(echo {})  \;
  </code></pre>
  
  <p>echo prints result of find. </p>
  
  <p>The urlencode is an alias:</p>
  
  <pre><code>$alias urlencode='python -c "import sys, urllib as ul; \
      print ul.quote_plus(sys.argv[1])"
  </code></pre>
  
  <p><a href="https://unix.stackexchange.com/questions/159253/decoding-url-encoding-percent-encoding">Decoding URL encoding (percent encoding)</a></p>
  
  <p>Can anyone explain this behavior and suggest solution?</p>