[
https://issues.apache.org/jira/browse/HDFS-9614?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15083056#comment-15083056
]
Daniel Templeton commented on HDFS-9614:
----------------------------------------
This was actually one of the puzzlers in my Hadoop puzzlers talk. The wildcard
will not bind to special characters.
The way to delete the file is:
{{python -c 'print "/user/hadoop/tangshangwen\r"' | xargs -n 1 hdfs dfs -rm}}
> If the path contains '\r' character, can not be deleted from the command line
> -----------------------------------------------------------------------------
>
> Key: HDFS-9614
> URL: https://issues.apache.org/jira/browse/HDFS-9614
> Project: Hadoop HDFS
> Issue Type: Bug
> Affects Versions: 2.2.0, 2.7.1
> Reporter: tangshangwen
> Assignee: tangshangwen
>
> In our cluster, I found that some users create directory contains '\r'
> character, cause we can not be deleted from the command line. for example
> {code:title=Test.java|borderStyle=solid}
> try {
> FileSystem fs = FileSystem.get(new Configuration());
> fs.mkdirs(new Path("/user/hadoop/tangshangwen\r"));
> IOUtils.closeQuietly(fs);
> } catch (IOException e) {
> e.printStackTrace();
> }
> {code}
> Then we delete
> {noformat}
> $ hdfs dfs -ls /user/hadoop/
> Found 4 items
> drwx------ - hadoop supergroup 0 2016-01-05 11:49
> /user/hadoop/.Trash
> drwx------ - hadoop supergroup 0 2016-01-05 12:04
> /user/hadoop/.staging
> drwxr-xr-x - hadoop supergroup 0 2016-01-05 12:42
> /user/hadoop/DistributedShell
> drwxr-xr-x - hadoop supergroup 0 2016-01-05 15:46
> /user/hadoop/tangshangwen
> $ hdfs dfs -rm -R /user/hadoop/tangshang*
> rm: `/user/hadoop/tangshang*': No such file or directory
> $ hdfs dfs -ls /user/hadoop/tangshangwen
> ls: `/user/hadoop/tangshangwen': No such file or directory
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)