Good question. I don't see anything in ftp.rb, but I could be missing
something. I'd be in favor of FTP#mput and FTP#mget methods myself.
Indulge me - try using a non-block form of Net::FTP and see if it makes
any difference:
cindexfiles = Dir.glob("*_*-*.pdf")
cindexfiles.each do |cindexfile|
ftp = Net::FTP.open('mpc.bna.com')
ftp.debug_mode = true
ftp.passive = true
ftp.login('peterb','pbail')
ftp.chdir('/data/ps2000test')
ftp.putbinaryfile(cindexfile)
end
Regards,
Dan
This communication is the property of Qwest and may contain confidential or
privileged information. Unauthorized use of this communication is strictly
prohibited and may be unlawful. If you have received this communication
in error, please immediately notify the sender by reply e-mail and destroy
all copies of the communication and any attachments.
···
-----Original Message-----
From: list-bounce@example.com
[mailto:list-bounce@example.com] On Behalf Of Peter Bailey
Sent: Tuesday, May 09, 2006 1:02 PM
To: ruby-talk ML
Subject: Re: RUBY on 64-bit Windows PCs.
Berger, Daniel wrote:
>> -----Original Message-----
>> From: list-bounce@example.com
>> [mailto:list-bounce@example.com] On Behalf Of Peter Bailey
>> Sent: Tuesday, May 09, 2006 11:59 AM
>> To: ruby-talk ML
>> Subject: Re: RUBY on 64-bit Windows PCs.
>
> <snip>
>
>> end
> I'm not sure it's related, but you're unnecessarily
reopening your ftp
> connection for every file. My *guess* is that one of those
sessions
> isn't closing properly, causing it to hang. Try moving the loop
> inside the block:
>
> cindexfiles = Dir.glob("*_*-*.pdf")
>
> Net::FTP.open('mpc.bna.com') do |ftp|
> ftp.debug_mode = true
> ftp.passive = true
> ftp.login(user, passwd)
> ftp.chdir('/data/ps2000test')
> cindexfiles.each do |cindexfile|
> ftp.putbinaryfile(cindexfile)
> end
> end
>
> If that still hangs for some reason, try a non block approach with
> Net::FTP and see if that works.
>
> Hope that helps.
>
> Dan
>
>
Yes, I know that I'm iterating ftps here. But, it works on multiple
32-bit machiens. That's why I'm questioning it. Anyway, is
there such a
thing as "mput" instead of just "put" in RUBY ftp? Without a
block, how
could I send multiple files in ftp?
>> From: list-bounce@example.com
> connection for every file. My *guess* is that one of those
> ftp.chdir('/data/ps2000test')
> Dan
>
>
Yes, I know that I'm iterating ftps here. But, it works on multiple
32-bit machiens. That's why I'm questioning it. Anyway, is
there such a
thing as "mput" instead of just "put" in RUBY ftp? Without a
block, how
could I send multiple files in ftp?
Good question. I don't see anything in ftp.rb, but I could be missing
something. I'd be in favor of FTP#mput and FTP#mget methods myself.
Indulge me - try using a non-block form of Net::FTP and see if it makes
any difference:
cindexfiles = Dir.glob("*_*-*.pdf")
cindexfiles.each do |cindexfile|
ftp = Net::FTP.open('mpc.bna.com')
ftp.debug_mode = true
ftp.passive = true
ftp.login('peterb','pbail')
ftp.chdir('/data/ps2000test')
ftp.putbinaryfile(cindexfile)
end
Regards,
Dan
This communication is the property of Qwest and may contain confidential
or
privileged information. Unauthorized use of this communication is
strictly
prohibited and may be unlawful. If you have received this communication
in error, please immediately notify the sender by reply e-mail and
destroy
all copies of the communication and any attachments.
Thanks for your ftp query. And, thanks for your persistence here. But,
sorry, I'm feeling kind of ignorant here. If I have a bunch of PDF files
in a directory, how can I do things to each of them, like ftp, WITHOUT a
block of some sort? Or, without some kind of multi-file ftp put, like
mput??
From: list-bounce@example.com [mailto:list-bounce@example.com] On Behalf Of Peter Bailey
Sent: Tuesday, May 09, 2006 1:02 PM
To: ruby-talk ML
Subject: Re: RUBY on 64-bit Windows PCs.
Berger, Daniel wrote:
From: list-bounce@example.com
[mailto:list-bounce@example.com] On Behalf Of Peter Bailey
Sent: Tuesday, May 09, 2006 11:59 AM
To: ruby-talk ML
Subject: Re: RUBY on 64-bit Windows PCs.
<snip>
end
I'm not sure it's related, but you're unnecessarily
reopening your ftp
connection for every file. My *guess* is that one of those
sessions
isn't closing properly, causing it to hang. Try moving the loop inside the block:
cindexfiles = Dir.glob("*_*-*.pdf")
Net::FTP.open('mpc.bna.com') do |ftp|
ftp.debug_mode = true
ftp.passive = true
ftp.login(user, passwd)
ftp.chdir('/data/ps2000test')
cindexfiles.each do |cindexfile|
ftp.putbinaryfile(cindexfile)
end
end
If that still hangs for some reason, try a non block approach with Net::FTP and see if that works.
Hope that helps.
Dan
Yes, I know that I'm iterating ftps here. But, it works on multiple 32-bit machiens. That's why I'm questioning it. Anyway, is there such a thing as "mput" instead of just "put" in RUBY ftp? Without a block, how could I send multiple files in ftp?
Good question. I don't see anything in ftp.rb, but I could be missing
something. I'd be in favor of FTP#mput and FTP#mget methods myself.
Indulge me - try using a non-block form of Net::FTP and see if it makes
any difference:
cindexfiles = Dir.glob("*_*-*.pdf")
cindexfiles.each do |cindexfile|
ftp = Net::FTP.open('mpc.bna.com')
ftp.debug_mode = true
ftp.passive = true
ftp.login('peterb','pbail')
ftp.chdir('/data/ps2000test')
ftp.putbinaryfile(cindexfile)
end
cindexfiles.each do |cindexfile|
ftp.putbinaryfile(cindexfile)
end
ftp.close
?
-Justin
Yes, that's definitely smarter. I thought about it last night, and, of
course, it's smarter to iterate just the files rather than the whole ftp
transaction. But, anyway, I tried this again this morning with IRB, just
sending one file, not many, and it freezes as soon as I type in the
"end."