Saturday 2 January 2016

Hadoop: copyFromLocal: copy file from local file system to HDFS

“copyFromLocal” command is used to Copy file from local file system to HDFS.

Usage
hadoop fs [generic options] -copyFromLocal [-f] [-p] [-l] <localsrc> ... <dst>

Options:
   The -f option will overwrite the destination if it already exists.
 
Example
 hadoop fs -copyFromLocal apacheNifi.docx /user/cloudera/demo1


$ls
apacheNifi.docx  atlasClient.docx  atlas.docx  a.txt  gradle.docx  maven.docx
$
$hadoop fs -ls /user/cloudera/demo1
$
$hadoop fs -copyFromLocal apacheNifi.docx /user/cloudera/demo1
$hadoop fs -copyFromLocal atlasClient.docx /user/cloudera/demo1
$hadoop fs -copyFromLocal atlas.docx /user/cloudera/demo1
$hadoop fs -copyFromLocal a.txt /user/cloudera/demo1
$hadoop fs -copyFromLocal gradle.docx /user/cloudera/demo1
$hadoop fs -copyFromLocal maven.docx /user/cloudera/demo1
$
$
$hadoop fs -ls /user/cloudera/demo1
Found 6 items
-rw-r--r--   1 cloudera cloudera          2 2022-03-22 23:58 /user/cloudera/demo1/a.txt
-rw-r--r--   1 cloudera cloudera    4724690 2022-03-22 23:57 /user/cloudera/demo1/apacheNifi.docx
-rw-r--r--   1 cloudera cloudera    6166736 2022-03-22 23:57 /user/cloudera/demo1/atlas.docx
-rw-r--r--   1 cloudera cloudera    9147128 2022-03-22 23:57 /user/cloudera/demo1/atlasClient.docx
-rw-r--r--   1 cloudera cloudera    6988969 2022-03-22 23:58 /user/cloudera/demo1/gradle.docx
-rw-r--r--   1 cloudera cloudera    8986359 2022-03-22 23:58 /user/cloudera/demo1/maven.docx
$



“ls” command is used to list files in a directory.
“mkdir” command is used to create a directory.
“cat” command is used to display contents of a file.




Referred Articles







Previous                                                 Next                                                 Home

No comments:

Post a Comment