Hi, At Sun, 7 Oct 2007 11:15:04 +0900, Peter Bailey wrote in [ruby-talk:272952]: > This always throws me. I keep getting "permission denied" messages when > I simply try to rename files. Here's my code. The files in the directory > start out without an extension. > > Dir.chdir("F:/images") Maybe on Windows? > Dir.glob("*").each do |file| > File.new(file, "r").gets This leaves the file still opened, and on Windows, it's prohibited by the OS to move/rename files while they are opened. if /%!PS-Adobe/ =~ IO.open(file) {|f| f.gets} File.rename(file, file + ".eps") end -- Nobu Nakada