code: func Replace(from, to string) error {
  	if err := os.RemoveAll(to); err != nil {
  		return err
  	}
  	if err := os.Rename(from, to); err != nil {
  		return err
  	}
  
  	// Directory was renamed; sync parent dir to persist rename.
  	pdir, err := OpenDir(filepath.Dir(to))
  	if err != nil {
  		return err
  	}
  
  	if err = pdir.Sync(); err != nil {
  		pdir.Close()
  		return err
  	}
  	return pdir.Close()
  }
docs: // Replace moves a file or directory to a new location and deletes any previous data.
  // It is not atomic.