title: need PowerShell script to copy files to subdirectory where basename points to directory
body: <p>I am a complete newbie to PowerShell and I have been reading some useful primers to try to get up to speed on PS in order to write a short script. I am hoping someone could guide me as to the primary PowerShell commands that will be needed in order to accomplish the following task:</p>
  
  <ol>
  <li><p>An input directory (e.g. C:\ImageTemp) contains a large number (many thousands) of jpeg files where the basename of each file uses the quadkey naming format. For example, 01223120.jpg where the basename corresponds to a particular tile location on the Earth.</p></li>
  <li><p>All basenames contain only the numbers 0, 1 ,2 and 3 and consist of between 3 and 15 characters. For example, 0234.jpg and 0312223001.jpg.</p></li>
  <li><p>I need to distribute all the jpeg files into subdirectories where the basename points to the subdirectory where the jpeg file should be stored. For example, 0234.jpg would be stored in \0\2\3\4 and 0312223001.jpg would be stored in \0\3\1\2\2\2\3\0\0\1</p></li>
  <li><p>An exception to item 3 above is that any filenames with 11 or more characters would be stored in the directory pointed to by the first 10 characters in the basename. For example, 03122230012311.jpg which contains 13 basename characters would be stored in the \0\3\1\2\2\2\3\0\0\1 directory.</p></li>
  <li><p>These subdirectories may or may not already exist so it may be necessary to create the directory before copying the jpeg file to it.</p></li>
  </ol>
  
  <p>Thanks in advance for your advice on how to tackle writing this script.</p>