Change file permissions via FTP

Discussion in 'Ruby' started by Luca Scatigno, Jun 4, 2009.

  1. Hi,

    I have to upload a file via FTP and then change its permissions, i'm
    using
    net/ftp but i don't know how to change the perms.
    How can I do that?
    Should I use another library?

    Thanks in advance.

    Luca
    --
    Posted via http://www.ruby-forum.com/.
     
    Luca Scatigno, Jun 4, 2009
    #1
    1. Advertising

  2. * Luca Scatigno <> wrote:
    >
    > Hi,
    >
    > I have to upload a file via FTP and then change its permissions, i'm
    > using
    > net/ftp but i don't know how to change the perms.
    > How can I do that?


    Not tested, but have you tried something like this?

    Net::FTP.open(host) do |conn|
    < login/chdir/upload code here >
    response = conn.sendcmd("SITE CHMOD 0664 #{filename}")
    end

    --
    Lars Haugseth
     
    Lars Haugseth, Jun 8, 2009
    #2
    1. Advertising

  3. Lars Haugseth wrote:
    > * Luca Scatigno <> wrote:
    >>
    >> Hi,
    >>
    >> I have to upload a file via FTP and then change its permissions, i'm
    >> using
    >> net/ftp but i don't know how to change the perms.
    >> How can I do that?

    >
    > Not tested, but have you tried something like this?
    >
    > Net::FTP.open(host) do |conn|
    > < login/chdir/upload code here >
    > response = conn.sendcmd("SITE CHMOD 0664 #{filename}")
    > end


    Thanks Lars,
    I've tried your suggestion and it works. It solved my problem.
    --
    Posted via http://www.ruby-forum.com/.
     
    Luca Scatigno, Jun 8, 2009
    #3
    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. Scott Allen
    Replies:
    0
    Views:
    474
    Scott Allen
    Jul 13, 2004
  2. Curt K
    Replies:
    0
    Views:
    592
    Curt K
    Nov 3, 2006
  3. N. Quisitive
    Replies:
    0
    Views:
    151
    N. Quisitive
    Jan 17, 2006
  4. Jeff Miller
    Replies:
    0
    Views:
    585
    Jeff Miller
    Mar 26, 2009
  5. D. Buck
    Replies:
    2
    Views:
    601
    D. Buck
    Jun 29, 2004
Loading...

Share This Page