def upload!(mode = "todo") # possible modes: todo, failure
      path  = File.join(config.path, "upload", mode, "*.yaml")
      files = Dir.glob(path)

      success_path = File.join(config.path, "upload", "success")
      failure_path = File.join(config.path, "upload", "failure")

      # Make sure directories exist
      FileUtils.mkdir_p(success_path)
      FileUtils.mkdir_p(failure_path)

      debug "[UPLOAD] #{files.count} files"
      files.each_with_index do |f, i|
        debug "#{f} (#{i})"
        file      = File.open(f, "rb")
        yamldata  = file.read
        file.close
        success   = @uploader.upload(:yamldata => yamldata)

        # CHECK: may another solution for base_name exist?
        base_name = f.split("/").last

        path = success ? success_path : failure_path
        path = File.join(path, base_name)

        # HACK: don't copy if mode == failure and failure again
        FileUtils.mv(f, path) unless !success && mode == "failure"
      end
    end
def upload!(mode = "todo") # possible modes: todo, failure
      path  = File.join(config.path, "upload", mode, "*.yaml")
      files = Dir.glob(path)

      success_path = File.join(config.path, "upload", "success")
      failure_path = File.join(config.path, "upload", "failure")

      # Make sure directories exist
      FileUtils.mkdir_p(success_path)
      FileUtils.mkdir_p(failure_path)

      debug "[UPLOAD] #{files.count} files"
      files.each_with_index do |f, i|
        debug "#{f} (#{i})"
        file      = File.open(f, "rb")
        yamldata  = file.read
        file.close
        success   = @uploader.upload(:yamldata => yamldata)

        # CHECK: may another solution for base_name exist?
        base_name = f.split("/").last

        path = success ? success_path : failure_path
        path = File.join(path, base_name)

        # HACK: don't copy if mode == failure and failure again
        FileUtils.mv(f, path) unless !success && mode == "failure"
      end
    end
NEW && UNTESTED