HDFql Reference Manual v2.6.0

6.4.12COPY FILE

Syntax

COPY [TRUNCATE] FILE file_name [, file_name]* TO new_file_name [, new_file_name]*

Description

Copy an existing file named file_name to new_file_name. Multiple files can be copied at once by separating their names with a comma (,). If new_file_name already exists, it is not overwritten, no subsequent files are copied, and an error is raised. To overwrite an existing file, specify the keyword TRUNCATE (all data stored in the file will be permanently lost).

Parameter(s)

file_name – mandatory string that specifies the name of the file to copy.

new_file_name – mandatory string that specifies the new name and/or location in the file system to use for copying file_name.

Return

Nothing

Example(s)

# copy a file named "my_file0.h5" to "my_file1.h5" (the file "my_file1.h5" will not be overwritten if it already exists)
COPY FILE my_file0.h5 TO my_file1.h5

# copy a file named "my_file2.h5" to "my_file3.h5" (the file "my_file3.h5" will be overwritten if it already exists)
COPY TRUNCATE FILE my_file2.h5 TO my_file3.h5

# copy two files named "my_file4.h5" and "my_file5.h5" to "my_file6.h5" and "my_file7.h5", respectively (both files "my_file6.h5" and "my_file7.h5" will be overwritten if they already exist)
COPY TRUNCATE FILE my_file4.h5, my_file5.h5 TO my_file6.h5, my_file7.h5

# copy a file named "my_file8.h5" into a root directory named "data" and rename it as "my_file9.h5" (the file "my_file9.h5" will not be overwritten if it already exists in this directory)
COPY FILE my_file8.h5 TO /data/my_file9.h5

# copy a file named "my_file10.h5" into a relative directory named "backup" (the file "my_file10.h5" will not be overwritten if it already exists in this directory)
COPY FILE my_file10.h5 TO backup/