title: Windows batch - Move files to folders based on file name & extension
body: <p>I am new to batch files although have searched thoroughly and found topics with a similar theme, although not covering what I precisely need.</p>
  
  <p><strong>Back story:</strong>
  I have an excel file which when saved generates two files, a .PDF and an .xlsm.  These files are saved into a 'To-Process' folder.</p>
  
  <p>They are named with the following naming convention: Company name - Date, so for example 'Daves Plumbing - 01-08-13.xlsm'
  'Daves Plumbing - 01-08-13.pdf'</p>
  
  <p><strong>Processing:</strong>
  Once a week I manually move these into separately named folders by company name e.g C:/documents/sales/excel/daves plumbing/
  C:/dociuments/sales/pdf/daves plumbing/</p>
  
  <p>I appreciate spaces in the company name don't help, but hopefully we could use the - as a delimiter?</p>
  
  <p>Ultimately I am looking to create a batch file which will automate the processing above by stepping through the files in the folder, reading the company name and moving each file to the relevant folder based on the name and extension.</p>
  
  <p>I can have upwards of 50 files in the folder at any one time when I decide to process.</p>
  
  <p>Help on this is greatly appreciated, I hope I have provided sufficient information to see if this is feasible.</p>
  
  <p>Many thanks,
  Ash</p>
  
  <p>p.s 
  As a side note, I am assuming I could not incorporate sending the PDF files as an email attachment prior to moving them?  e.g execute batch file, send PDF's via email to pre-defined email address, then move both 'pdf' and 'xlsm' to relevant folders.  This is not important, merely curious of the capabilities of batch processing.</p>