Alex Gutteridge wrote in post #1082939:
> On 05.11.2012 13:01, Peter Bailey wrote:
>>>
>> that folder. I run this script, along with many, many other scripts
>> like
>> it, with a scheduling utility called ActiveBatch. I've told that
>> scheduling utility to fire this script when there's one PDF, at
>> least,
>> in the folder. So, yes, the ARGV[0] stands for the one file at a time
>> way of executing against one or more PDF files. Thanks.
>
> As Brian says it looks like ARGV[0] is not getting set (i.e.
> ActiveBatch is running it without an argument). It's a bit confusing
> because you say this will only be run if there are one or more pdf
> files, but then explicitly test for whether there are any files - is it
> just belt and braces? Is this (untested obvs.) snippet equivalent to
> what you want?
>
> require 'rubygems'
> require 'fileutils'
> require 'net/ftp'
>
> Dir.chdir("F:/workflows/graphics/asura-post/vijay/in")
>
> pdffiles = Dir.glob("*.pdf")
> exit if pdffiles.length == 0
>
> FileUtils.cp(pdffiles[0], "//mako/archive/vijay")
> FileUtils.mv(pdffiles[0], "../scratch")

OK. Well, I've discovered that this script actually runs just fine in 
the command shell. But, it doesn't run inside my Ruby editor. I get the 
"nil" error when I run the script inside my Ruby editor.  But, if I go 
to the command shell with a PDF file in that directory and run the 
script, it runs fine. So, I've sent an e-mail to my Ruby editor folks. 
Thanks.

-- 
Posted via http://www.ruby-forum.com/.