创建目录时添加一组属性
//来自 N o w J a v a . c o m import java.io.IOException; import java.nio.file.FileSystems; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.attribute.FileAttribute; import java.nio.file.attribute.PosixFilePermission; import java.nio.file.attribute.PosixFilePermissions; import java.util.Set; public class Main { public static void main(String[] args) { Path newdir = FileSystems.getDefault().getPath( "/home/folder1/folder2/2010/"); Set<PosixFilePermission> perms = PosixFilePermissions//from 时代Java公众号 - N o w J a v a . c o m .fromString("rwxr-x---"); FileAttribute<Set<PosixFilePermission>> attr = PosixFilePermissions .asFil