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>
-f |
Overwrites the destination if it already exists |
-p |
Preserves file attributes [topx] (timestamps, ownership, |
Examples:
$ hadoop fs -cp /user/hadoop/file1 /user/hadoop/file2
$ hadoop fs -cp /user/hadoop/file1 /user/hadoop/file2 /user/hadoop/dir