List of utility methods to do File Mod Change
void | chmod(@Nonnull File file, int mode) chmod final Path path = file.toPath(); if (!Files.isSymbolicLink(path)) { Files.setPosixFilePermissions(path, getPermissions(mode)); |
void | Chmod(boolean recursive, String permission, String directoryFile) Change permission of files and directories String osName = System.getProperty("os.name"); String command = "chmod"; if (recursive) { command += " -R"; if (osName.startsWith("Mac OS")) { Runtime.getRuntime().exec(command + " " + permission + " " + directoryFile); } else if (osName.startsWith("Windows")) { ... |
int | chmod(File file, int mode) chmod return chmod(file.getName(), mode);
|
void | chmod(File file, String mode) chmod Runtime.getRuntime().exec(new String[] { "chmod", mode, file.getAbsolutePath() }); |
void | chmod(final int mode, final File path) chmod path.setReadable(false, false ); path.setWritable(false, false ); path.setExecutable(false, false ); path.setReadable((mode & 0400) == 0400, true ); path.setWritable((mode & 0200) == 0200, true ); if (path.isDirectory() || (mode & 0100) == 0100) { path.setExecutable(true, true ); if ((mode & 0044) == 0044) { path.setReadable(true, false ); if ((mode & 0011) == 0011) { path.setExecutable(true, false ); |
void | chmod(final String path, final String mode) chmod final String[] cmdarray = new String[] { "chmod", mode, path }; Runtime.getRuntime().exec(cmdarray, null, null); |
int | chmod(String filename, String perm) Change the permissions on a filename. String cmd = "chmod " + perm + " " + filename; Process p = Runtime.getRuntime().exec(cmd, null); return p.waitFor(); |
boolean | chmodX(String filename) chmod X File f = new File(filename); if (f.exists()) return f.setExecutable(true); return false; |