I'm working on a script and trying to move the file processed to a
subdir after processing. Here's an cut down extract of my code...

# example code starts
require 'ftools'
basedir = "#{RAILS_ROOT}/data_files/resort_photos/"
target = "#{RAILS_ROOT}/data_files/resort_photos/processed"

Dir["#{RAILS_ROOT}/data_files/resort_photos/*.*"].each do |file|
# process one file at a time

  # lets state the filename
  puts "Processing: #{file}"

   puts "Moving...."
   file.move(basedir + file, target + file)    #  What should I be doing
here ?
   puts "Moved..."

end

# example code stops

At present it results in this error...

Moving....
rake aborted!
private method `move' called for #<String:0x1030a2f18>

thanks

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