The hadoop copyFromLocal command is used to copy a file from the local file system to the hadoop hdfs. The syntax and usage example are shown below:
Syntax:
hadoop fs -copyFromLocal <localsrc> URI
Example:
Check the data in local file
> ls sales
2000,iphone
2001, htc
Now copy this file to hdfs
> hadoop fs -copyFromLocal sales /user/DPhadoop/hadoopdemo
View the contents of the hdfs file.
> hadoop fs -cat /user/DPhadoop/hadoopdemo/sales
2000,iphone
2001, htc
Syntax:
hadoop fs -copyFromLocal <localsrc> URI
Example:
Check the data in local file
> ls sales
2000,iphone
2001, htc
Now copy this file to hdfs
> hadoop fs -copyFromLocal sales /user/DPhadoop/hadoopdemo
View the contents of the hdfs file.
> hadoop fs -cat /user/DPhadoop/hadoopdemo/sales
2000,iphone
2001, htc