public static void changeLocalFileGroup ( String path , String group ) throws IOException { UserPrincipalLookupService lookupService = FileSystems . getDefault ( ) . getUserPrincipalLookupService ( ) ; PosixFileAttributeView view = Files . getFileAttributeView ( Paths . get ( path ) , PosixFileAttributeView . class , LinkOption . NOFOLLOW_LINKS ) ; GroupPrincipal groupPrincipal = lookupService . lookupPrincipalByGroupName ( group ) ; view . setGroup ( groupPrincipal ) ; }
Changes the local file s group .