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.
30b69e32ae7907da6d508e3883a16365?d=identicon&s=25 Luca Scatigno (skatz)
on 2009-06-04 18: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
E67536b7234fcf4e0c01b100826cfc60?d=identicon&s=25 Lars Haugseth (Guest)
on 2009-06-08 13:40
(Received via mailing list)
* Luca Scatigno <skatz82@gmail.com> 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
30b69e32ae7907da6d508e3883a16365?d=identicon&s=25 Luca Scatigno (skatz)
on 2009-06-08 14:09
Lars Haugseth wrote:
> * Luca Scatigno <skatz82@gmail.com> 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.