Copying a file from one directory to another with Ruby
Something like this should work. my_dir = Dir[“C:/Documents and Settings/user/Desktop/originalfiles/*.doc”] my_dir.each do |filename| name = File.basename(‘filename’, ‘.doc’)[0,4] dest_folder = “C:/Documents and Settings/user/Desktop/destinationfolder/#{name}/” FileUtils.cp(filename, dest_folder) end You have to actually specify the destination folder, I don’t think you can use wildcards.