title: Linux - Create sub-directories from file names in current directory
body: <p>I have a list of files in a directory like below.</p>
  
  <pre><code>/file1 - filename1.txt
  /file2 - filename2a.txt
  /file2 - filename2b.txt
  /file3 - filename3.txt
  /file4 - filename4.txt
  /file5 - filename5.txt
  </code></pre>
  
  <p>I am trying to create a script that will parse the files in the specified or working directory, to create folders from the filenames before the dash, if they dont already exist and ignore that file if they do. Then the script will move that filename in the newly created sub-directory.</p>
  
  <p>For example, the list will eventually look like the below.</p>
  
  <pre><code>/file1/file1 - filename1.txt
  /file2/file2 - filename2a.txt
  /file2/file2 - filename2b.txt
  /file3/file3 - filename3.txt
  /file4/file4 - filename4.txt
  /file5/file5 - filename5.txt
  </code></pre>
  
  <p>Any help would be appreciated. Thank you.</p>