Hi all,

A question relating to the code below.

What I'm trying to do is:
Files named CAL221107.xls, NCPH141202.xls or GOH333333.xls for example
in the current directory should be appended to an array (just the file
name, not the full path) and moved to ./sent/

It seems to be working, but is there a more Rubyish way of doing it?

-------------------------------------------------------------------------
require 'find'
require 'fileutils'

a=[]
fglob = Regexp.new('(CAL|NCPH|GOH)\d{6}\.xls')

Find.find('./') do |path|
  curr_file = File.basename(path)
  if curr_file =~ /#{fglob}/
    a << curr_file
    new_file = "./sent/#{curr_file}"
    FileUtils.mv(curr_file, new_file) if not File.exists?(new_file)
  end
end

puts a

-------------------------------------------------------------------------

thanks,

-- 
Mark