This is an odd problem, I admit. I'm currently working on a short script
to sort a set of JPEGs by size, but right now I'm just trying to move
them from point A to point B (I'm still learning Ruby, so I do this to
try and figure things out before getting into the big stuff), and so far
I have gotten so far as:

####################CODE####################

#!/usr/bin/ruby -wd

require "RMagick"
require "fileutils"

Dir.chdir(ARGV[0])

for pix in Dir.glob("*.{jpeg,jpg,png}")
	filetype = Magick::Image::read(pix).first.format
	workdir = Dir.pwd
	If File.directory?(filetype) then
		FileUtils.move("#{pix}", "#{workdir}/#{filetype}")
	else
		Dir.mkdir(filetype)
		FileUtils.move("#{pix}", "#{workdir}/#{filetype}")
	end
end

####################//CODE####################

The error I keep getting these error messages:

Exception 'Errno::ENOENT' at /usr/lib/ruby/1.8/fileutils.rb:1420 - no
such file or directory - <insert pathname to where jpg is being moved
to>

Exception 'Errno::ENOENT' at /usr/lib/ruby/1.8/fileutils.rb:1200 - no
such file or directory - <insert pathname to where jpg is being moved
to>

for every file. These errors come, while the file is STILL moved. I'm
not sure what the error is, but its a noisy one (testdir I made for
trying this out has ~1900 files in it).

Any clue as to the problem?