Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java set file folder permissions

//if you need rw-rw-r  permissions 
public void setPermission(File file) throws IOException{
    Set<PosixFilePermission> perms = new HashSet<>();
    perms.add(PosixFilePermission.OWNER_READ);
    perms.add(PosixFilePermission.OWNER_WRITE);

    perms.add(PosixFilePermission.OTHERS_READ);
    perms.add(PosixFilePermission.OTHERS_WRITE);

    perms.add(PosixFilePermission.GROUP_READ);

    Files.setPosixFilePermissions(file.toPath(), perms);
}
Comment

PREVIOUS NEXT
Code Example
Java :: java run class file 
Java :: maximum number from random number in java 
Java :: getresources in adapter android 
Java :: java border 
Java :: Add an element to ArrayList using addall() method 
Java :: how to make jenkins pipeline choose specific java version 
Java :: java system.out.println shortcut 
Java :: what is delegation in java 
Java :: area of rectangle in java 
Java :: java csv compare 
Java :: initialize an arraylist in java in java 
Java :: HashMap to store key and value pair. 
Java :: Java Find the greatest common divisor of two positive integers. The integers can be large, so you need to find a clever solution. 
Java :: horizontalAlignment center jlabel 
Java :: java swing on close 
Java :: java create array with values 
Java :: arrays methods in java 
Java :: command to create a Hashmap in Java 
Java :: abstract class java constructor 
Java :: java add two arrays together 
Java :: arrays with for loops 
Java :: encode file to utf-8 in java 
Java :: lcm of two number in java 
Java :: android click button programmatically 
Java :: java creating an arraylist 
Java :: convert string array to string 
Java :: Java Thread Example Using the Thread Class 
Java :: private method in interface java 
Java :: authentication in spring boot 
Java :: javafx 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =