Could you add some parameter documentation here?  Specify that $root_dir is an HDFS path, etc.