title: ValueError: not enough values to unpack (expected 2, got 1) when splitting strings
body: <p>I've tried to write a script that moves files from one folder to a selection of folders depending on what I have named the file.</p>
  <p>For example, 'Physics - a' would be moved from the 'ts' folder to '/Physics/Assignments' in an effort to organize my notes.</p>
  <p>This runs continuously in the background and allocates these files new homes the moment that something is placed into the 'ts' folder.</p>
  <p>My script works, but after allocating two files, <strong>I get the following error</strong>:</p>
  <blockquote>
  <p>line 14, add = name.split('-') ValueError: not enough values to unpack
  (expected 2, got 1).</p>
  </blockquote>
  <p>I don't understand why this occurs, nor how to fix it.</p>
  <pre><code>import os
  import time
  from datetime import date
  
  def clean():
  
      os.chdir('/Users/Chadd/Desktop/ts')
  
      i = 0
      while i &lt; len(os.listdir()):
          i = 0
          
          name, ext = os.path.splitext(os.listdir()[i])
          code, add = name.split('-')
          folder = code.strip().upper()
  
          if add.strip() == 'a':
              add = 'Assignments'
  
          if add.strip() == 'p':
              add = 'Past Papers'
  
          if add.strip() == 'n':
              add = 'Notes'
  
          if add.strip() == 't':
              add = 'Tutorials'
  
          today = date.today()
  
          os.rename(
          '/Users/Chadd/Desktop/ts/{}'.format(os.listdir()[i]),
          '/Users/Chadd/Desktop/{}/{}/{}'.format(folder, add, folder + ' - ' + add[:-1] + ' (' + str(today) + ')' + ' - ' + str(1 + len(os.listdir('/Users/Chadd/Desktop/{}/{}'.format(folder, add.strip())))) + ext)
           )
  
          if len(os.listdir()) == 0:
              break
  
  while True:
      clean()
      time.sleep(1)
  </code></pre>