Wednesday 23 March 2022

Hadoop: get: copy folder from hdfs to local system

“get” command is used to copy files from HDFS to local system.

 

Usgae:

hadoop fs [generic options] -get [-p] [-ignoreCrc] [-crc] <src> ... <localdst>

 


Example

hadoop fs -get /user/cloudera/demo1 ./getDemo/

 

Above command copies the folder ‘/user/cloudera/demo1’ from hdfs to the local system folder getDemo.

$hadoop fs -ls /user/cloudera/demo1
Found 5 items
-rw-r--r--   1 cloudera cloudera          2 2022-03-22 23:58 /user/cloudera/demo1/a.txt
-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
$
$mkdir getDemo
$
$hadoop fs -get /user/cloudera/demo1 ./getDemo/
$
$ls ./getDemo/
demo1
$
$ls ./getDemo/demo1/
atlasClient.docx  atlas.docx  a.txt  gradle.docx  maven.docx

 

 

Previous                                                 Next                                                 Home

No comments:

Post a Comment