Forum: Ruby Change file permissions via FTP

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Luca S. (Guest)
on 2009-06-04 20:25
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
Lars H. (Guest)
on 2009-06-08 15:40
(Received via mailing list)
* Luca S. <removed_email_address@domain.invalid> 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
Luca S. (Guest)
on 2009-06-08 16:09
Lars H. wrote:
> * Luca S. <removed_email_address@domain.invalid> 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.
This topic is locked and can not be replied to.