1

I am writing a ksh script to clean up hdfs directories and files at least 10 days old. I am testing the deletion command in a terminal, but it kept saying it is wrong:

$ hdfs dfs -find "/file/path/file" -depth -type d -mtime +10 -exec rm -rf {} \;
find: Unexpected argument: -depth

What am I doing wrong?

Michael Mrozek
  • 93,103
  • 40
  • 240
  • 233
Misha
  • 13

2 Answers2

1

The hdfs dfs command executes the following command in a special shell that is not fully Unix compatible, some of the programs available there are like the Unix programs but others are not. The find program is one of them, the expressions that command understands in hdfs are only the following:

-name pattern
-iname pattern
-print
-print0Always

So the expression that you are trying out there does not work within the hdfs shell unfortunately.

Source: The hadoop documentation

ojs
  • 932
0

Those functionalities are supported in Hadoop 2.7 https://issues.apache.org/jira/browse/HADOOP-8989