Page tree

 

JAVA

FORTRAN

C++

C

 

Link

h5copy

Copies an HDF5 object within an HDF5 file or from one HDF5 file to another

Syntax:
h5copy [OPTIONS] [OBJECTS]

Description:
h5copy  copies an HDF5 object (a dataset, named datatype, or group) from an input HDF5 file to an output HDF5 file.

If a group is specified as the input object, any objects in that group will be recursively copied.

The output file may or may not already exist.

h5copy will fail if the destination object name already exists.

Arguments:

Options and Parameters:

-h   or   --help

Print a usage message and exit.

-v   or   --verbose

Produce verbose output, printing information regarding the specified options and objects.

-V   or   --Version

Print version information.

-p   or   --parents

Create parent or intermediate groups as required. (There is no error if they already exist.)

-f flag_type   or   --flag=flag_type

Specify one or more of several copy options; flag_type may be one of the following strings or a logical AND of two or more:

shallow Copy only immediate members of a group. 
(Default: Recursively copy all objects below the group.)
soft Expand soft links to copy target objects. 
(Default: Keep soft links as they are.)
ext Expand external links to copy external objects. 
(Default: Keep external links as they are.)
ref Copy references and any referenced objects, i.e., objects that the references point to.

Referenced objects are copied in addition to the objects specified on the command line and reference datasets are populated with correct reference values. Copies of referenced datasets outside the copy range specified on the command line will normally have a different name from the original.

(Default:Without this option, reference value(s) in any reference datasets are set to NULL and referenced objects are not copied unless they are otherwise within the copy range specified on the command line.)

attr Copy objects without copying attributes. 
(Default: Copy objects and all attributes.)
allflags  Switch each setting above from the default to the setting described in this table. 
Equivalent to logical AND of all flags above.

Objects (all required):

-i input_file   or   --input=input_file

Input HDF5 file name

-o output_file   or   --output=output_file

Output HDF5 file name (existing or non-existing)

-s source_object   or   --source=source_object

Input HDF5 object name within the input file

-d destination_object   or   --destination=destination_object

Output HDF5 object name within the output file

Exit Status:
0Succeeded.
> 0    An error occurred.

Example:
In verbose mode, create a new file, test1.out.h5, containing the object array in the root group, copied from the existing file test1.h5 and object array.
    h5copy -v -i "test1.h5" -o "test1.out.h5" -s "/array" -d "/array
        

In verbose mode and using the flag shallow to prevent recursion in the file hierarchy, create a new file, test1.out.h5, containing the object array in the root group, copied from the existing file test1.h5 and object array.

    h5copy -v -f shallow -i "test1.h5" -s "/array" -o test1.out.h5" -d "/array"

History:
Release    Change
1.8.0Tool introduced in this release.
1.8.7Tool updated to accept same file as input file and as output file.

--- Last Modified: August 28, 2019 | 09:01 AM