ayushtkn commented on PR #5547:
URL: https://github.com/apache/hadoop/pull/5547#issuecomment-1511269735
> Some pathnames which contains special character(s) may lead to unexpected
results. For example, there is a file named "/foo/file*" in my cluster, created
by "DistributedFileSystem.create(new Path("/foo/file*"))". When I want to
remove it, I type in "hadoop fs -rm /foo/file*" in shell. However, I remove all
the files with the prefix of "/foo/file*" unexpectedly. There are also some
other characters just like '*', such as ' ', '|', '&', etc.
Should have escaped the special character. That is how shell behaves.
```
bash-4.2$ hdfs dfs -ls /dir
Found 6 items
drwxr-xr-x - hadoop supergroup 0 2023-04-17 12:41 /dir/a
drwxr-xr-x - hadoop supergroup 0 2023-04-17 12:41 /dir/ab*
drwxr-xr-x - hadoop supergroup 0 2023-04-17 12:42 /dir/abc
drwxr-xr-x - hadoop supergroup 0 2023-04-17 12:42 /dir/abcd
drwxr-xr-x - hadoop supergroup 0 2023-04-17 12:42 /dir/abcde
drwxr-xr-x - hadoop supergroup 0 2023-04-17 12:42 /dir/abcdef
bash-4.2$ hdfs dfs -rm -r /dir/ab\\*
Deleted /dir/ab*
bash-4.2$ hdfs dfs -ls /dir
Found 5 items
drwxr-xr-x - hadoop supergroup 0 2023-04-17 12:41 /dir/a
drwxr-xr-x - hadoop supergroup 0 2023-04-17 12:42 /dir/abc
drwxr-xr-x - hadoop supergroup 0 2023-04-17 12:42 /dir/abcd
drwxr-xr-x - hadoop supergroup 0 2023-04-17 12:42 /dir/abcde
drwxr-xr-x - hadoop supergroup 0 2023-04-17 12:42 /dir/abcdef
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]