Put file on HDFS with spaces in name

梦想的初衷 提交于 2019-12-01 09:35:41

The most obvious workaround is to rename the file before storing it on HDFS, don't you think?

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

HDFS is totally fine with spaces in the file or directory names.

It is the hdfs that does not support putting a file from local disk with spaces in its file name. But there is a trick to achieve this ( reference ):

cat file\ name\(1\).zip | hadoop fs -put - "/tmp/one/file name(1).zip"

Hope this helps those that need this.

try

fs -put 'file name(1).zip' tmp/one

hadoop fs -get /landing/novdata/'2017-01-05 - abc def 5H.csv'

See the single quotes around the filename

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!