code: func (u *Uploader) Scan() error {
  	df, err := os.Open(u.scanDir)
  	err = trace.ConvertSystemError(err)
  	if err != nil {
  		return trace.Wrap(err)
  	}
  	defer df.Close()
  	entries, err := df.Readdir(-1)
  	if err != nil {
  		return trace.ConvertSystemError(err)
  	}
  	var count int
  	for i := range entries {
  		fi := entries[i]
  		if fi.IsDir() {
  			continue
  		}
  		if !strings.HasSuffix(fi.Name(), "completed") {
  			continue
  		}
  		parts := strings.Split(fi.Name(), ".")
  		if len(parts) < 2 {
  			u.Debugf("Uploader, skipping unknown file: %v", fi.Name())
  			continue
  		}
  		sessionID := session.ID(parts[0])
  		lockFilePath := filepath.Join(u.scanDir, fi.Name())
  		if err := u.uploadFile(lockFilePath, sessionID); err != nil {
  			if trace.IsCompareFailed(err) {
  				u.Debugf("Uploader detected locked file %v, another process is uploading it.", lockFilePath)
  				continue
  			}
  			return trace.Wrap(err)
  		}
  		count += 1
  	}
  	return nil
  }
docs: // Scan scans the directory and uploads recordings