Saturday 2 January 2016

Hadoop: copyToLocal: Copy file from hdfs to local system

“copyToLocal” command is used to copy data from HDFS to local system.

Usage
hadoop fs [generic options] -copyToLocal [-p] [-ignoreCrc] [-crc] <src> ... <localdst>
 
Example
hadoop fs -copyToLocal /user/cloudera/demo4/a.txt /home/cloudera/Desktop/dir1 
 
Above snippet copy the file '/user/cloudera/demo4/a.txt' from HDFS to your system folder '/home/cloudera/Desktop/dir1'.
 
$ls /home/cloudera/Desktop/dir1
$
$hadoop fs -ls /user/cloudera/demo4
Found 3 items
-rw-r--r--   1 cloudera cloudera          2 2022-03-23 09:03 /user/cloudera/demo4/a.txt
-rw-r--r--   1 cloudera cloudera         35 2022-03-23 09:03 /user/cloudera/demo4/b.txt
-rw-r--r--   1 cloudera cloudera         55 2022-03-23 09:03 /user/cloudera/demo4/c.txt
$
$
$hadoop fs -copyToLocal /user/cloudera/demo4/a.txt /home/cloudera/Desktop/dir1
$
$ls /home/cloudera/Desktop/dir1
a.txt
 


Referred Articles




Previous                                                 Next                                                 Home

No comments:

Post a Comment