From: Curt Hibbs Date: 2004-03-16T14:24:39+09:00 Subject: How can I copy a read-only file? I've got a generic method that copies files. I want to preserve the attributes of the source file in the destination file. I started using this: require "ftools" ... File.copy(src_file, dest_dir) This works until I encounter a read-only file, then I get an exception: c:/ruby/lib/ruby/1.8/ftools.rb:23:in `initialize': Permission denied - E:\Dev\RubyDev\rubyinstaller\c vs-repo\installer\stable/doc\DBD/ODBC-0.96/COPYING (Errno::EACCES) So I tried switching to FileUtils.cp, and got the same error. I also trued this: FileUtils.chmod( 0644, src_file) FileUtils.cp(src_file, dest_dir) But still it still doesn't work -- I get the same error: c:/ruby/lib/ruby/1.8/fileutils.rb:409:in `initialize': Permission denied - E:\Dev\RubyDev\rubyinstaller\cvs-r epo\installer\stable/doc\DBD/ODBC-0.96/COPYING (Errno: :EACCES) So, how do you copy read-only files in ruby? Curt