Created
January 14, 2013 02:20
-
-
Save ThomasWunderlich/4527338 to your computer and use it in GitHub Desktop.
Copy file (Ruby)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
from_file, to_file=ARGV | |
script = $0 | |
puts "Copying from #{from_file} to #{to_file}" | |
input = File.open(from_file).input.read() | |
puts "The input file is #{input.length} bytes long" | |
puts "Does the output file exist? #{File.exists? to_file}" | |
puts "hit Control-C to abort, Return to continue" | |
astdin.gets | |
output = File.open(to_file, 'w') | |
output.write(input) | |
puts "finished" | |
output.close() | |
input.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment