I am in need of some help with moving some files. I have some folders
that are inside an images directory, and inside each of the these
directories there are images that I want to move to another folder so
that all the images are all in the same folder.

Here's what I got so far, one problem is when I call photos, it looks at
the directory where the script is held, but I want it to look at the
directory the images are in.

require 'fileutils'

current_dir = Dir.pwd

photos = Dir.glob("*.{jpg,gif}")

directories = Array.new
Dir.new(Dir.pwd).entries.each { |dir| directories.push(dir) if
File.directory?(dir) }

directories.each do |dir|
  next if dir.eql?(".")
  next if dir.eql?("..")
  photos.each do |pic|
    FileUtils.mv(pic, "C:\Scripts\folder 2")
  end
end

Any help is appricated

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