public static final void setGroup(String name, Path... files) throws IOException
    {
        if (supports("posix"))
        {
            for (Path file : files)
            {
                FileSystem fs = file.getFileSystem();
                UserPrincipalLookupService upls = fs.getUserPrincipalLookupService();
                GroupPrincipal group = upls.lookupPrincipalByGroupName(name);
                PosixFileAttributeView view = Files.getFileAttributeView(file, PosixFileAttributeView.class);
                view.setGroup(group);
            }
        }
        else
        {
            JavaLogging.getLogger(PosixHelp.class).warning("no posix support. setGroup(%s)", name);
        }
    }
public static final void setGroup ( String name , Path ... files ) throws IOException { if ( supports ( "posix" ) ) { for ( Path file : files ) { FileSystem fs = file . getFileSystem ( ) ; UserPrincipalLookupService upls = fs . getUserPrincipalLookupService ( ) ; GroupPrincipal group = upls . lookupPrincipalByGroupName ( name ) ; PosixFileAttributeView view = Files . getFileAttributeView ( file , PosixFileAttributeView . class ) ; view . setGroup ( group ) ; } } else { JavaLogging . getLogger ( PosixHelp . class ) . warning ( "no posix support. setGroup(%s)" , name ) ; } }
Change group of given files. Works only in linux
@param name
@param files
@throws IOException
@see org.vesalainen.util.OSProcess#call(java.lang.String...)