Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

ruby file copy

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!
Source by ruby-doc.org #
 
PREVIOUS NEXT
Tagged: #ruby #file #copy
ADD COMMENT
Topic
Name
8+8 =