title: Find/Match variable filenames and move files to respective directory
body: <p>I've <strong><em>never</em></strong> come to SO asking "Do my homework" but I really don't know where to start with this one.</p>
  
  <p>I have a load of documents which are dumped in a directory after being auto-signed using JSignPdf (<code>--output-directory</code> option seemingly has no ability to output to same as input):</p>
  
  <pre><code>/some/dir/Signed/PDF1_signed.pdf
  /some/dir/Signed/PDF2_signed.pdf
  /some/dir/Signed/PDF2_signed.pdf
  </code></pre>
  
  <p>I'd like to then find their source/unsigned counterparts:</p>
  
  <pre><code>/some/dir/with/docs/PDF1.pdf
  /some/dir/where/is/PDF2.pdf
  /some/dir/why/this/PDF3.pdf
  </code></pre>
  
  <p>...and move the signed PDFs into the respective directories.</p>
  
  <p>I use the command, to find all the PDFs in the variety of directories: </p>
  
  <pre><code>find . -name '*.pdf' -exec sh -c 'exec java -jar jsignpdf-1.4.3/JSignPdf.jar ... ' sh {} +
  </code></pre>
  
  <p>...and I've tried things like making <code>find</code> output a variable and then using IF THEN to match with no success. Would I need <code>find</code> output to be made into multiple variables? I'm so lost :(</p>
  
  <p>I'd like to accomplish this in some shell, but if there are Perl junkies out there or anything else, I am more than happy for another <em>portable</em> solution.</p>
  
  <p>I've tried to break it down, but still don't understand how to accomplish it...</p>
  
  <ul>
  <li>find files matching VarName without _signed</li>
  <li>move _signed file with matching name to the directory of found file</li>
  </ul>
  
  <p>Thanks for any help/guidance.</p>