# Iterate over hdf5 names()

**URL:** <https://discourse.julialang.org/t/iterate-over-hdf5-names/21706>\
**Category:** Performance\
**Created:** [March 10, 2019, 2:57pm UTC](https://discourse.julialang.org/t/iterate-over-hdf5-names/21706 "2019-03-10T14:57:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidavdav](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davidavdav/32/1065_2.png) [@davidavdav](https://discourse.julialang.org/u/davidavdav)\
**Post date:** [March 10, 2019, 2:57pm UTC](https://discourse.julialang.org/t/iterate-over-hdf5-names/21706/1 "2019-03-10T14:57:36Z")

</div>

Hello,

I’ve got a large, flat HDF5 file, and I’d like to iterate over the objects with a name matching `r".*-y"`.

It seems I can iterate objects over `fd = HFD5.h5open(filename)` using

```julia
for obj in fd
   ## use obj
end

```

but then I can’t find out the name of the object (that should match `r".*-y"`). I would be looking for something like `name(obj)`.

Or I can iterate over the names:

```julia
for key in names(fd)
   ## use fd[key]
end

```

but it seems that `names(fd)` collects all names first, which involves reading the entire file, which in my case takes a very long time, so this seems to be inefficient.

Would anybody know a nice solution to this?

Thanks

---

<div class="post-metadata">

**Author:** ![davidavdav](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davidavdav/32/1065_2.png) [@davidavdav](https://discourse.julialang.org/u/davidavdav)\
**Post date:** [March 10, 2019, 4:38pm UTC](https://discourse.julialang.org/t/iterate-over-hdf5-names/21706/2 "2019-03-10T16:38:49Z")

</div>

OK, though `show(obj)` and `@less show(stdout, obj)` I found that what I was looking for is the unexported `HDF5.name(obj)`.
