user2891099
user2891099

Reputation: 125

Hadoop Syntax Error When Copying Local files into Hadoop fs

I am trying to copy a set of csv files from my hard drive into a hadoop fs, but I am receiving a Syntax error when I excute the following code:

'# hadoop fs -put  'C:\myfolder\myfile.csv'  /user/root/

put: unexpected URISyntaxException

Is this not the correct syntax?

Upvotes: 1

Views: 6489

Answers (3)

Sandeep Kumar
Sandeep Kumar

Reputation: 288

Try:

hadoop fs -copyFromLocal C:\\myfolder\\myfile.csv /user/root/

or

hadoop fs -copyFromLocal C:/myfolder/myfile.csv /user/root/

--NOTE--

Only Full path will work.

Upvotes: 2

Naveen Subramani
Naveen Subramani

Reputation: 2184

In Linux env Both syntax should work

bin/hadoop fs -put /home/username/Documents/test.csv /usr/test1.csv

bin/hadoop fs -copyFromLocal /home/naveen/username/test.csv /usr/test1.csv

The difference between put and copyFromLocal is in copyFromLocal the source is restricted to a local file reference

Refer this url for shell commands

http://hadoop.apache.org/docs/r0.18.3/hdfs_shell.html#copyFromLocal

Upvotes: 0

rkh
rkh

Reputation: 863

I never used put for that...

Try:

hadoop fs -copyFromLocal C:\myfolder\myfile.csv myfile.csv

Upvotes: 0

Related Questions