title: Bash script to organize files based on their name
body: <p>I need help getting a bash script set up to move files to folders based on the beginning of their name (up til the first .), so for example:</p>
  <ul>
  <li>aaa.123.txt</li>
  <li>aaa.124.txt</li>
  <li>aaa.156.txt</li>
  <li>aaa.122.txt</li>
  <li>bbb.1424.txt</li>
  <li>bbb.13.txt</li>
  <li>bbb.13.txt</li>
  <li>ccc.222.txt</li>
  </ul>
  <p>this would generate the following folders, with the appropriate text files inside</p>
  <ul>
  <li>aaa/
  <ul>
  <li>aaa.123.txt</li>
  <li>aaa.124.txt</li>
  <li>aaa.156.txt</li>
  <li>aaa.122.txt</li>
  </ul>
  </li>
  <li>bbb/
  <ul>
  <li>bbb.1424.txt</li>
  <li>bbb.13.txt</li>
  <li>bbb.13.txt</li>
  </ul>
  </li>
  <li>ccc/
  <ul>
  <li>ccc.222.txt</li>
  </ul>
  </li>
  </ul>