Put file on HDFS with spaces in name

前端 未结 5 455
旧巷少年郎
旧巷少年郎 2021-01-15 05:23

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 had

相关标签:
5条回答
  • 2021-01-15 05:45

    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.

    0 讨论(0)
  • 2021-01-15 05:51

    try

    fs -put 'file name(1).zip' tmp/one
    
    0 讨论(0)
  • 2021-01-15 05:55

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

    0 讨论(0)
  • hadoop fs -get /landing/novdata/'2017-01-05 - abc def 5H.csv'

    See the single quotes around the filename

    0 讨论(0)
  • 2021-01-15 06:04

    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
    
    0 讨论(0)
提交回复
热议问题