hadoopdirectorydelete-directory

How to delete a directory in hadoop which has the '[' character in its name


I accidentally uploaded a file to the "/hadoo[-workshop" path and I am trying to delete it.

I am using the hadoop fs -rmr <path> Hadoop 0.20.2 . I have tried every permutation of putting the file path in single quotes ('), double quotes ("), and escaping the "[" character with a backslash (), but every time i get an error saying

rmr: Illegal file pattern: Expecting set closure character or end of range, or } for glob hadoo[-workshop at 15


Solution

  • I managed to delete it by using a wildcard (*) in the command.

    hadoop fs -rmr /hadoo*

    I guess "deleting everything that start with the string before faulty character" is good enough.

    NOTE: If you use this and you have other directories with a similar name don't use -skipTrash to be able to recover the other directories