Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #21923 > unrolled thread

How to do chown or chgrp

Started byloial <jldunn2000@gmail.com>
First post2013-01-31 06:56 -0800
Last post2013-02-01 06:37 -0800
Articles 8 — 4 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  How to do chown or chgrp loial <jldunn2000@gmail.com> - 2013-01-31 06:56 -0800
    Re: How to do chown or chgrp Arne Vajhøj <arne@vajhoej.dk> - 2013-01-31 10:37 -0500
    Re: How to do chown or chgrp lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-01-31 15:57 +0000
      Re: How to do chown or chgrp Arne Vajhøj <arne@vajhoej.dk> - 2013-02-01 17:56 -0500
        Re: How to do chown or chgrp lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-02-02 08:55 +0000
          Re: How to do chown or chgrp Roedy Green <see_website@mindprod.com.invalid> - 2013-02-02 08:34 -0800
            Re: How to do chown or chgrp lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-02-02 20:26 +0000
    Re: How to do chown or chgrp Roedy Green <see_website@mindprod.com.invalid> - 2013-02-01 06:37 -0800

#21923 — How to do chown or chgrp

Fromloial <jldunn2000@gmail.com>
Date2013-01-31 06:56 -0800
SubjectHow to do chown or chgrp
Message-ID<713a2f2b-eaad-4689-9089-314683eac4b3@googlegroups.com>
What is the best way to run the unix chown and chgrp commands in Java?

I only need to run these commands on one file at at time.

[toc] | [next] | [standalone]


#21925

FromArne Vajhøj <arne@vajhoej.dk>
Date2013-01-31 10:37 -0500
Message-ID<510a8fcf$0$283$14726298@news.sunsite.dk>
In reply to#21923
On 1/31/2013 9:56 AM, loial wrote:
> What is the best way to run the unix chown and chgrp commands in Java?
>
> I only need to run these commands on one file at at time.

Runtime exec or the newer ProcessBuilder.

Arne

[toc] | [prev] | [next] | [standalone]


#21926

Fromlipska the kat <"nospam at neversurrender dot co dot uk">
Date2013-01-31 15:57 +0000
Message-ID<dc6dnZedsLT0CZfMnZ2dnUVZ7tKdnZ2d@bt.com>
In reply to#21923
On 31/01/13 14:56, loial wrote:
> What is the best way to run the unix chown and chgrp commands in Java?
>
> I only need to run these commands on one file at at time.

Surely the 'Java' way (in 1.7 at least) is

java.nio.file.Files.setPosixFilePermissions

lipska

-- 
Lipska the Kat©: Troll hunter, sandbox destroyer
and farscape dreamer of Aeryn Sun

[toc] | [prev] | [next] | [standalone]


#21983

FromArne Vajhøj <arne@vajhoej.dk>
Date2013-02-01 17:56 -0500
Message-ID<510c483a$0$294$14726298@news.sunsite.dk>
In reply to#21926
On 1/31/2013 10:57 AM, lipska the kat wrote:
> On 31/01/13 14:56, loial wrote:
>> What is the best way to run the unix chown and chgrp commands in Java?
>>
>> I only need to run these commands on one file at at time.
>
> Surely the 'Java' way (in 1.7 at least) is
>
> java.nio.file.Files.setPosixFilePermissions

As owner and group are not in PosixFilePermission
then surely not.

But it is close.

Files getFileAttributeView with PosixFileAttributeView will
provide setOwner and set Group for a programmatic solution.

Arne

PS: There is also Files setOwner but as it has no setGroup, then I
     would go for the other.




[toc] | [prev] | [next] | [standalone]


#22002

Fromlipska the kat <"nospam at neversurrender dot co dot uk">
Date2013-02-02 08:55 +0000
Message-ID<2pKdnRaZE_H6SZHMnZ2dnUVZ8qidnZ2d@bt.com>
In reply to#21983
On 01/02/13 22:56, Arne Vajhøj wrote:
> On 1/31/2013 10:57 AM, lipska the kat wrote:
>> On 31/01/13 14:56, loial wrote:
>>> What is the best way to run the unix chown and chgrp commands in Java?
>>>
>>> I only need to run these commands on one file at at time.
>>
>> Surely the 'Java' way (in 1.7 at least) is
>>
>> java.nio.file.Files.setPosixFilePermissions
>
> As owner and group are not in PosixFilePermission
> then surely not.

Ah yes, setPosixFilePermissions would be chmod.

My mistake

lipska

-- 
Lipska the Kat©: Troll hunter, sandbox destroyer
and farscape dreamer of Aeryn Sun

[toc] | [prev] | [next] | [standalone]


#22006

FromRoedy Green <see_website@mindprod.com.invalid>
Date2013-02-02 08:34 -0800
Message-ID<q0gqg8prvtlcfph7ip23knhrn0q231h814@4ax.com>
In reply to#22002
On Sat, 02 Feb 2013 08:55:02 +0000, lipska the kat <"nospam at
neversurrender dot co dot uk"> wrote, quoted or indirectly quoted
someone who said :

>> As owner and group are not in PosixFilePermission
>> then surely not.
>
>Ah yes, setPosixFilePermissions would be chmod.

How about Files.setOwner ?
-- 
Roedy Green Canadian Mind Products http://mindprod.com
The first 90% of the code accounts for the first 90% of the development time.
The remaining 10% of the code accounts for the other 90% of the development 
time. 
~ Tom Cargill  Ninety-ninety Law 

[toc] | [prev] | [next] | [standalone]


#22023

Fromlipska the kat <"nospam at neversurrender dot co dot uk">
Date2013-02-02 20:26 +0000
Message-ID<5tednY7kibHp65DMnZ2dnUVZ7o-dnZ2d@bt.com>
In reply to#22006
On 02/02/13 16:34, Roedy Green wrote:
> On Sat, 02 Feb 2013 08:55:02 +0000, lipska the kat<"nospam at
> neversurrender dot co dot uk">  wrote, quoted or indirectly quoted
> someone who said :
>
>>> As owner and group are not in PosixFilePermission
>>> then surely not.
>>
>> Ah yes, setPosixFilePermissions would be chmod.
>
> How about Files.setOwner ?

The OP needed chown and chgrp

chmod - Files.setPosixFilePermissions
chown - PosixFileAttributeView.setOwner
chgrp - PosixFileAttributeView.setGroup

Seems to be one way to do it.

lipska

-- 
Lipska the Kat©: Troll hunter, sandbox destroyer
and farscape dreamer of Aeryn Sun

[toc] | [prev] | [next] | [standalone]


#21955

FromRoedy Green <see_website@mindprod.com.invalid>
Date2013-02-01 06:37 -0800
Message-ID<amkng8lmipr96ibga02hfglc7mp3lncs5q@4ax.com>
In reply to#21923
On Thu, 31 Jan 2013 06:56:06 -0800 (PST), loial <jldunn2000@gmail.com>
wrote, quoted or indirectly quoted someone who said :

>What is the best way to run the unix chown and chgrp commands in Java?
>
>I only need to run these commands on one file at at time.

see http://mindprod.com/jgloss/exec.html

If you need speed, you will want to write some JNI or find a JNI
library that already does what you want.

http://mindprod.com/jgloss/jni.html
-- 
Roedy Green Canadian Mind Products http://mindprod.com
The first 90% of the code accounts for the first 90% of the development time.
The remaining 10% of the code accounts for the other 90% of the development 
time. 
~ Tom Cargill  Ninety-ninety Law 

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web