Created 06-22-2021 02:58 AM
I am trying to upload some files having special characters in filename and getting below error.
case:1
======
Command: hdfs dfs -put 900-0314-Slide#2.vsi /user/xyz12345
error: put: `900-0314-Slide': No such file or directory
It might be due to # character.
case: 2
======
Command: hdfs dfs -put 'abc.html?C=S;O=A' /user/xyz12345
error: No such file or directory
Created 09-03-2021 12:36 AM
Hello @AnuradhaV,
Thanks for raising questions in community. We usually don't suggest to put files with special characters in file name to hdfs. If you have to do this you should replace the special characters with URL encoding.
For example, below characters should be encoded as:
# encoded as %23
? encoded as %3F
= encoded as %3D
; encoded as %3B
A full list of URL encoding characters:
https://www.degraeve.com/reference/urlencoding.php
To help you test it out, I created these files in my local and then put them to hdfs:
# ls
900-0314-Slide#2.vsi abc.html?C=S;O=A
# hdfs dfs -put 900-0314-Slide%232.vsi /tmp/
# hdfs dfs -put abc.html%3FC%3DS%3BO%3DA /tmp/
# hdfs dfs -ls /tmp
Found 2 items
-rw-r--r-- 3 hdfs supergroup 0 2021-09-03 07:07 /tmp/900-0314-Slide#2.vsi
-rw-r--r-- 3 hdfs supergroup 0 2021-09-03 07:15 /tmp/abc.html?C=S;O=A
Thanks,
Will
If the answer helps, please accept as solution and click thumbs up.
Created 09-12-2021 11:07 PM
@AnuradhaV, has any of the replies helped resolve your issue? If so, please mark the appropriate reply as the solution, as it will make it easier for others to find the answer in the future.
Regards,
Vidya Sargur,Created 06-22-2021 11:38 PM
@AnuradhaV Below Discussion may be applied in this case as well.
Created 11-22-2021 04:08 AM
Thanks for your suggestion. I tried using double slash but it not worked for me.
Created 09-02-2021 08:59 AM
you should "kinit" with your workload user credentials in CDP.before running any Hadoop commands
Created 09-03-2021 12:36 AM
Hello @AnuradhaV,
Thanks for raising questions in community. We usually don't suggest to put files with special characters in file name to hdfs. If you have to do this you should replace the special characters with URL encoding.
For example, below characters should be encoded as:
# encoded as %23
? encoded as %3F
= encoded as %3D
; encoded as %3B
A full list of URL encoding characters:
https://www.degraeve.com/reference/urlencoding.php
To help you test it out, I created these files in my local and then put them to hdfs:
# ls
900-0314-Slide#2.vsi abc.html?C=S;O=A
# hdfs dfs -put 900-0314-Slide%232.vsi /tmp/
# hdfs dfs -put abc.html%3FC%3DS%3BO%3DA /tmp/
# hdfs dfs -ls /tmp
Found 2 items
-rw-r--r-- 3 hdfs supergroup 0 2021-09-03 07:07 /tmp/900-0314-Slide#2.vsi
-rw-r--r-- 3 hdfs supergroup 0 2021-09-03 07:15 /tmp/abc.html?C=S;O=A
Thanks,
Will
If the answer helps, please accept as solution and click thumbs up.
Created 09-12-2021 11:07 PM
@AnuradhaV, has any of the replies helped resolve your issue? If so, please mark the appropriate reply as the solution, as it will make it easier for others to find the answer in the future.
Regards,
Vidya Sargur,Created 11-22-2021 04:05 AM
Thanks a lot Will, it resolved my issue. Thanks for providing encoding link.
Cheers
Anuradha V