title: Batch move files based on part of file name - Windows 8
body: <p>I've got a number of files I'm trying to sort through for my PhD research. I'm not familiar with using Batch files but I do have some coding experience.</p>
  
  <p>I'm trying to move the files based on part of their filename into folders generated automatically for them in the directory they're currently in.</p>
  
  <p>The files were generated as part of a series of pXRF analyses on brass objects held at a museum.</p>
  
  <p>Some examples of the file structure:</p>
  
  <ul>
  <li>01-64.1007-1-LID.pdz </li>
  <li>01-64.1007-2-BASE.pdz </li>
  <li>02-67.1765-1.pdz</li>
  <li>02-67.1765-2.pdz </li>
  <li>02-67.1765-3.pdz</li>
  </ul>
  
  <p>etc.</p>
  
  <p>Basically the file structure works like this:</p>
  
  <p>The first number is my unique identifier for the object, then a hyphen, then the museums unique identifier, then a hyphen, then a number to show which analysis of the object. Finally, there may or may not be a small descriptor (i.e. BASE or LID) which helps me identify where I performed the scan.</p>
  
  <p>So to break it down 01-64.1007-1-LID means Object 1 - Museum Accession Number 64.1007 - First Analysis - Performed on the lid of the object - .pdz is the file extension.</p>
  
  <p>02-67.1765-2 means Object 2 - Museum Accession Number 67.1765 - Second Analysis etc.</p>
  
  <p>What I want to do is move:</p>
  
  <ul>
  <li>01-64.1007-1-LID.pdz</li>
  <li>01-64.1007-2-BASE.pdz</li>
  </ul>
  
  <p>into a folder called:</p>
  
  <ul>
  <li>01-64.1007</li>
  </ul>
  
  <p>and </p>
  
  <ul>
  <li>02-67.1765-1.pdz</li>
  <li>02-67.1765-2.pdz</li>
  <li>02-67.1765-3.pdz</li>
  </ul>
  
  <p>into a folder called:</p>
  
  <ul>
  <li>02-67.1765</li>
  </ul>
  
  <p>etc.</p>
  
  <p>I've seen a few scripts which may help with this but I'm unsure how to tweak them for my purposes. If anyone can help I'd really appreciate it!</p>
  
  <p>Thanks,</p>
  
  <p>Mike </p>