vsphere/internal/helper/datastore/datastore_helper.go
func FileExists(ds *object.Datastore, name string) (bool, error) {
	files, err := SearchDatastore(ds, name)
	if err != nil {
		return false, err
	}
	if len(files) > 1 {
		return false, fmt.Errorf("multiple results returned for %q in datastore %q, use a more specific search", name, ds)
	}
	if len(files) < 1 {
		return false, nil
	}
	return path.Base(name) == files[0].Path, nil
}
func FileExists(ds *object.Datastore, name string) (bool, error) {
	files, err := SearchDatastore(ds, name)
	if err != nil {
		return false, err
	}
	if len(files) > 1 {
		return false, fmt.Errorf("multiple results returned for %q in datastore %q, use a more specific search", name, ds)
	}
	if len(files) < 1 {
		return false, nil
	}
	return path.Base(name) == files[0].Path, nil
}
// FileExists takes a path in the datastore and checks to see if it exists.
//
// The path should be a bare path, not a datastore path. Globs are not allowed.