I did not try this. What is the error or return code when you use FileUtil https://hadoop.apache.org/docs/stable/api/org/apache/hadoop/fs/FileUtil.html#chmod(java.lang.String, java.lang.String, boolean)
chmod public static int *chmod* <https://hadoop.apache.org/docs/stable/api/src-html/org/apache/hadoop/fs/FileUtil.html#line.865>(String <http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true> filename, String <http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true> perm, boolean recursive) throws IOException <http://download.oracle.com/javase/6/docs/api/java/io/IOException.html?is-external=true> Change the permissions on a file / directory, recursively, if needed. *Parameters:*filename - name of the file whose permissions are to changeperm - permission stringrecursive - true, if permissions should be changed recursively*Returns:*the exit code from the command.*Throws:*IOException <http://download.oracle.com/javase/6/docs/api/java/io/IOException.html?is-external=true> On Wed, Sep 17, 2014 at 8:22 AM, Mohammad Islam <[email protected]> wrote: > Hi, > Is there a *programatic* solution to do it recursively? > I'm using Hadoop 2.3.0. > > I tried the followings: > > 1. I tried FileSystem.mkdirs( path, permission), it created the directory > but the permission is not set correctly. > > 2. I tried FileSystem.setPermisison(path, permission), it changes only the > current directory not recursively. > > 3. I tried to use FileUtil.chmod() with no luck, > > 4. new FsShell(conf).run(new String[]{"-chmod" , "-R", "777", > "/tmp/mislam"}); it worked but looks like it is not a good solution to > execute a shell. > > > Questions : > 1. Is there a solution for this? > 2. If not, is there any JIRA for this? I didn't find one. > 3. What next? > > Regards, > Mohammad >
