cp

Copies files from source to destination. This command allows multiple sources as well in which case the destination must be a directory.

The raw.* namespace extended attributes are preserved if the source and destination filesystems support them (HDFS only), and all source and destination pathnames are in the /.reserved/raw hierarchy.

Determination of whether the raw.* namespace xattrs are preserved is independent of the -p (preserve) flag.

Returns 0 on success and -1 on error.

The usage is as follows:

$ hadoop fs -cp [-f] [-p | -p[topax]] URI [URI ...] <dest>
Arguments

-f

Overwrites the destination if it already exists

-p

Preserves file attributes [topx] (timestamps, ownership,
permission, ACL, XAttr).
If -p is specified with no arg, then preserves timestamps, ownership, permission.
If -pa is specified, then preserves permission also because ACL is a super-set of permission. Determination of whether raw namespace extended attributes are preserved is independent of the -p flag

Examples:

$ hadoop fs -cp /user/hadoop/file1 /user/hadoop/file2
$ hadoop fs -cp /user/hadoop/file1 /user/hadoop/file2 /user/hadoop/dir
Found a mistake? Seleсt text and press Ctrl+Enter to report it