This commit is contained in:
Dan Buch 2012-02-26 20:55:09 -05:00
parent 1b00a0f514
commit a76a8a0804
3 changed files with 26 additions and 0 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
*~
copied.txt

22
ex17.rb Normal file
View File

@ -0,0 +1,22 @@
from_file, to_file = ARGV
script = $0
puts "Copying from #{from_file} to #{to_file}"
# we could do these two on one line too, how?
input = File.open(from_file)
indata = input.read()
puts "The input file is #{indata.length} bytes long"
puts "Does the output file exist? #{File.exists? to_file}"
puts "Ready, hit RETURN to continue, CTRL-C to abort."
STDIN.gets
output = File.open(to_file, 'w')
output.write(indata)
puts "Alright, all done."
output.close()
input.close()

3
test.txt Normal file
View File

@ -0,0 +1,3 @@
To all the people out there.
I say I don't like my hair.
I need to shave it off.