首页 > 解决方案 > 试图将文件夹从本地移动到包含 %20 的 hdfs。无法复制目录

问题描述

我正在尝试将文件夹从我的本地系统移动到其中包含 %20 的 hdfs。我无法更改文件夹名称,因为它是列的值,并且这些是由 spark 在写入文件时使用分区列创建的。我需要将它们原样移动到 hdfs 并在 hive / impala 表中查看它们。

前任:

HADOOP_USER_NAME=vishal hdfs dfs -copyFromLocal "/home/vishal/incoming/partition-edit/tableName/cp_sys_name=Change%20Request%20Satisfaction%20Survey/cp_evaluation_method=survey/" /data/files/vishal/managed/asmt_metric_type_orc_sep_29/cp_sys_name=Change%20Request%20Satisfaction%20Survey/cp_evaluation_method=survey

执行上面的命令,但它在内部将 %20 视为空格并抛出 File not found 异常。

Error while Inserting data into target: copyFromLocal: `/home/vishal/incoming/partition-edit/asmt_metric_type_orc_sep_29/cp_sys_name=Change Request Satisfaction Survey/cp_evaluation_method=survey/': No such file or directory

java.io.IOException: copyFromLocal: `/home/vishal/incoming/partition-edit/tableName/cp_sys_name=Change Request Satisfaction Survey/cp_evaluation_method=survey/': 
No such file or directory

标签: hadoophdfs

解决方案


您可以尝试用 %2520 替换 %20 吗?想法是用代码“%25”替换“%”并用“20”替换


推荐阅读