Hi,

-----Original Message-----
From: ChrisH [mailto:chris.hulan / gmail.com] 
Sent: Tuesday, February 13, 2007 3:30 PM
To: ruby-talk ML
Subject: Re: Problem with File.mv

/*
Looks like you need to ensure you are not trying to move the '.' (and
also '..') dirs.
*/

hm, i tried with a method found in 'The Ruby Way ' 
where '.' and '..' are skipped =

def recurse(src, dst)
#Dir.mkdir(dst)
# commented out as dstdir already exists
	Dir.foreach(src) do |e|
	# Don't bother with . and ..
	next if [".",".."].include? e
	fullname = src + "/" + e
	newname = fullname.sub(Regexp.new(Regexp.escape(src)),dst)
		if FileTest::directory?(fullname)
		recurse(fullname,newname)
		FileUtils.cp(fullname, newname, :verbose => true)
		else
		puts "??? : #{fullname}"
		end
	end
end


and

CANDIDATE = Dir["#{SRCDIR}/*"].collect { |f| 
 [test(?M, f), f] 
 }.sort.collect { |f| f[1] }[0]

recurse("#{CANDIDATE}", "T:/Foobar")

gave me another error :

c:/ruby/lib/ruby/1.8/fileutils.rb:1245:in `initialize': 
Permission denied - T:/rubytest/deploy/E023889/INCLIB (Errno::EACCES)

??!

Regards, Gilbert