Changing file extension using ruby
ruby, ruby-on-rails, rubygems
Solution
Improving the previous answer a little:
require 'fileutils'
Dir.glob('/path_to_file_directory/*.eml').each do |f|
FileUtils.mv f, "#{File.dirname(f)}/#{File.basename(f,'.*')}.html"
end
The `File.basename(f,'.*')` will give you the name without the extension otherwise the files will endup being file_name.eml.html instead of file_name.html
Problem
I have a list of .eml files which are in a remote folder say ``` \\abcremote\pickup ``` I want to rename all the files from ``` xyz.eml to xyz.html ``` Could you guys help me do that using ruby. Thanks in advance.