put

Copies a single file or multiple files from the local file system to the destination file system. It also reads input from stdin and writes to the destination file system if the source is set to -. Copying fails if the file already exists, unless the -f flag is given.

Returns 0 on success and -1 on error.

The usage is as follows:

$ hadoop fs -put [-f] [-p] [-l] [-d] [-t <thread count>] [ - | <localsrc1> .. ]. <dst>
Arguments

-p

Preserves access and modification time, ownership, and the permissions (assuming the permissions can be propagated across filesystems)

-f

Overwrites the destination if it already exists

-l

Allows DataNode to lazily persist a file to disk; forces the replication factor of 1. This flag results in reduced durability. Be cautious when using this argument

-d

Skips the creation of the temporary file with the suffix .COPYING

Example:

$ hadoop fs -put localfile /user/hadoop/hadoopfile
$ hadoop fs -put -f localfile1 localfile2 /user/hadoop/hadoopdir
$ hadoop fs -put -d localfile hdfs://nn.example.com/hadoop/hadoopfile
$ hadoop fs -put - hdfs://nn.example.com/hadoop/hadoopfile
Found a mistake? Seleсt text and press Ctrl+Enter to report it