file = File.open('text.txt', 'r') # Opening file
copied_file = File.open('new_text.txt', 'w') # Creating new file
copied_file.puts(file.read) # Copying file
# Closing files
file.close
copied_file.close
# Testing
copied_file = File.open('new_text.txt', 'r') # Opening copied file
puts(copied_file.read)
# => What markets are called black? Those in Africa!