Thank you in advance for your time.
I have a rather simple question regarding the best/easiest way to clone (I.e. Make a copy in disk) of an HDF5 file. For example, there is an HDF5 file: file.h5. I would like to copy the contents of this file into file_BU.h5. The reason for this is that there is a possibility my job that writes to the file will be killed partway through a write (to multiple datasets), and I would like to have a backup in between each "generation" of writes so I can recover the most recent good state.
Of course I could use normal file copy code such as Copy a file in a sane, safe and efficient way (or a naive system( "cp file.h5 file_BU.h5" ) ). However, this is an HDF5 specific question -- I'm wondering if there is a function to clone() an HDF5 file. Example code snippet below:
H5::H5File file;
file = H5::H5File( "file.h5", H5F_ACC_TRUNC );
//TODO Write datasets etc. to file
std::string file2name = "file_BU.h5";
//This is the thing I would like to do:
file.clone( file2name );
file.close();
//file_BU.h5 and file.h5 are now identical on disk...