This is because the source h5 file has been edited multiple times and the file size increased although the content is decreased. I have used h5pack.exe to compact the file instead. I thought the h5copy.exe is more versatile because it allows selective copy and allows merged copy to another file.
I see. Doing tool-based freespace management is tedious. Depending on your version constraints, in HDF5 1.10+ freespace management has gotten a lot better. fsm.c (3.3 KB)
Have a look at the attached example and let us know if that works for you. G.