Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Put file on HDFS with spaces in name

Tags:

hadoop2

hdfs

I have a file named file name(1).zip (with the space and parentheses in it) and I want to put this file on the HDFS. But everytime I try to put it via hadoop fs -put ... , I get a an exception.

I have even tried to add quotes around the file and even tried to escape the space and parentheses but it doesn't work.

hduser@localhost:/tmp$ hadoop fs -put file\ name\(1\).zip /tmp/one
15/06/05 15:57:46 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
put: unexpected URISyntaxException

hduser@localhost:/tmp$ hadoop fs -put "file\ name\(1\).zip" /tmp/one/
15/06/05 15:59:19 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
put: unexpected URISyntaxException

hduser@localhost:/tmp$ hadoop fs -put "file name(1).zip" /tmp/one/
15/06/05 16:00:36 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
put: unexpected URISyntaxException

Is there any work-around to put such files on the HDFS or am I missing something here.

like image 311
Saif Asif Avatar asked Dec 02 '25 23:12

Saif Asif


1 Answers

Replace the spaces with %20.

The percent-encoding for space is %20

Use

hadoop fs -put first%20name.zip /tmp/one

instead of

hadoop fs -put first name.zip /tmp/one
like image 71
Munesh Avatar answered Dec 05 '25 13:12

Munesh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!