Rebhan, Gilbert
2/13/2007 3:06:00 PM
Hi,
sorry forgot, if i use def recurse with =
FileUtils.cp(fullname, newname, :verbose => true)
i get =
c:/ruby/lib/ruby/1.8/fileutils.rb:1245:in `initialize':
Permission denied - T:/rubytest/deploy/E023889/INCLIB (Errno::EACCES)
if i use
FileUtils.mv(fullname, newname, :verbose => true)
when targetdir is already existent
i get =
c:/ruby/lib/ruby/1.8/fileutils.rb:495:in `mv': File exists -
T:/Foobar/INCLIB (Errno::EEXIST)
if i use
Dir.mkdir(dst)
...
FileUtils.mv(fullname, newname, :verbose => true)
and the targetdir is not existent before the message call i get =
c:/ruby/lib/ruby/1.8/fileutils.rb:501:in `rename':
Permission denied - T:/rubytest/deploy/E023889/INCLIB or
Y:/Foobar/INCLIB (Errno::EACCES)
??
Env = Windows 2000, Ruby 1.8.4 (2006-04-14) [i386-mswin32]
Regards, Gilbert
-----Original Message-----
From: Rebhan, Gilbert [mailto:Gilbert.Rebhan@huk-coburg.de]
Sent: Tuesday, February 13, 2007 3:57 PM
To: ruby-talk ML
Subject: Re: Problem with File.mv
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