change dir owner

Discussion in 'Perl' started by Frank McCown, Nov 30, 2003.

  1. Frank McCown

    Frank McCown Guest

    This has probably been answered a million times, but I can't seem to
    find the answer.

    How can I change the owner of a directory using a Perl command? I
    know chown can be used with files, but it doesn't appear to work with
    directories.

    Thanks in advance,
    Frank
     
    Frank McCown, Nov 30, 2003
    #1
    1. Advertising

  2. Frank McCown

    Frank McCown Guest

    I found that you can issue a system command that works instead, but it
    seems like there should be a Perl function that does the same.

    system("chown username.groupname my_folder");
     
    Frank McCown, Dec 1, 2003
    #2
    1. Advertising

  3. Frank McCown

    dw Guest

    "Frank McCown" <> wrote in message
    news:...
    > I found that you can issue a system command that works instead, but it
    > seems like there should be a Perl function that does the same.
    >
    > system("chown username.groupname my_folder");


    it's in there....
    perldoc -f chown
     
    dw, Dec 2, 2003
    #3
  4. Frank McCown

    Frank McCown Guest

    This is a reference to the chown function that changes FILE ownership,
    not DIRECTORY ownership. I've tried to use the chown function to
    modifiy dir ownership, and it fails.

    >
    > it's in there....
    > perldoc -f chown
     
    Frank McCown, Dec 2, 2003
    #4
  5. Frank McCown

    Guest

    (Frank McCown) wrote in message news:<>...
    > This has probably been answered a million times, but I can't seem to
    > find the answer.


    Possibly because the question doesn't exist.

    > How can I change the owner of a directory using a Perl command? I
    > know chown can be used with files, but it doesn't appear to work with
    > directories.


    Please produce a minimal but complete set of instuctions to reproduce
    the apparance of it not working.

    This newsgroup does not exist (see FAQ). Please do not start threads
    here.
     
    , Dec 2, 2003
    #5
  6. Frank McCown

    dw Guest

    "Frank McCown" <> wrote in message
    news:...
    > This is a reference to the chown function that changes FILE ownership,
    > not DIRECTORY ownership. I've tried to use the chown function to
    > modifiy dir ownership, and it fails.
    >
    > >
    > > it's in there....
    > > perldoc -f chown


    It works for me on both files and directories using 5.8 on both Linux and
    cygwin.

    Only problem I had on Linux was a permission problem when doing it as
    someone other than root... doing
    chown $owner, -1, $dir or print "unable to change $dir: $!"
    gave me "Operation not permitted" as me, but as root, it worked without a
    problem.

    What error did it give you?

    From cygwin:
    $ ll
    total 0
    drwxrwxrwx+ 2 SYSTEM None 0 Dec 2 23:29 dir/
    -rw-rw-rw- 1 SYSTEM None 0 Dec 2 23:29 file1
    -rw-rw-rw- 1 David None 0 Dec 2 23:29 file2

    $ perl -e 'chown ((stat("file2"))[4], -1, "dir", "file1");'

    $ ll
    total 0
    drwxrwxrwx+ 2 David None 0 Dec 2 23:29 dir/
    -rw-rw-rw- 1 David None 0 Dec 2 23:29 file1
    -rw-rw-rw- 1 David None 0 Dec 2 23:29 file2
     
    dw, Dec 3, 2003
    #6
  7. Frank McCown

    Frank McCown Guest

    dw-

    Your code snippet worked fine on my system. I ran my original code
    this morning and I can't reproduce my original error (yet)... very
    frustrating.

    I really appreciate your time.


    nobull-

    You are one witty guy. Why don't you tell the guys at Google that
    this newsgroup doesn't "exist", and maybe they'll disable their
    software to allow posts to it.
     
    Frank McCown, Dec 5, 2003
    #7
  8. Frank McCown

    Guest

    In a follow-up to someone else, but clearly supposed to be in response
    to my post, (Frank McCown) wrote:

    > You are one witty guy. Why don't you tell the guys at Google that
    > this newsgroup doesn't "exist", and maybe they'll disable their
    > software to allow posts to it.


    http://groups.google.com/groups?threadm=
     
    , Dec 8, 2003
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?UnVkeQ==?=

    Sub Dir, Virtual dir, what do I use?

    =?Utf-8?B?UnVkeQ==?=, Jun 12, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    432
    =?Utf-8?B?UnVkeQ==?=
    Jun 12, 2005
  2. Svend-Erik Madsen

    Dir set different owner ?

    Svend-Erik Madsen, Jan 22, 2004, in forum: Ruby
    Replies:
    1
    Views:
    123
    Svend-Erik Madsen
    Jan 22, 2004
  3. Matthew Denner
    Replies:
    1
    Views:
    188
  4. Iñaki Baz Castillo

    How to change the owner of a method in a block?

    Iñaki Baz Castillo, Sep 10, 2008, in forum: Ruby
    Replies:
    6
    Views:
    119
    Iñaki Baz Castillo
    Sep 11, 2008
  5. Kga Agk
    Replies:
    2
    Views:
    153
    Kga Agk
    Jun 29, 2009
Loading...

Share This Page