def renameUnprocessedFolder(path, tag):
 for i in itertools.count():
  if (i == 0):
   new_path = ('%s (%s)' % (path, tag))
  else:
   new_path = ('%s (%s[%d])' % (path, tag, i))
  if os.path.exists(new_path):
   i += 1
  else:
   os.rename(path, new_path)
   return

def renameUnprocessedFolder ( path , tag ) : for i in itertools . count ( ) : if ( i == 0 ) : new_path = ( '%s (%s)' % ( path , tag ) ) else : new_path = ( '%s (%s[%d])' % ( path , tag , i ) ) if os . path . exists ( new_path ) : i += 1 else : os . rename ( path , new_path ) return
rename a unprocessed folder to a new unique name to indicate a certain status .