hadoop copy a local file system folder to HDFS

Tariq picture Tariq · Jan 29, 2015 · Viewed 214.5k times · Source

I need to copy a folder from local file system to HDFS. I could not find any example of moving a folder(including its all subfolders) to HDFS

$ hadoop fs -copyFromLocal /home/ubuntu/Source-Folder-To-Copy HDFS-URI

Answer

Ashrith picture Ashrith · Jan 29, 2015

You could try:

hadoop fs -put /path/in/linux /hdfs/path

or even

hadoop fs -copyFromLocal /path/in/linux /hdfs/path

By default both put and copyFromLocal would upload directories recursively to HDFS.