Plutonic Rainbows

Palmbomen II - Memories of Cindy

Listening to this new album today while I try and understand how Python calculates a file size and then copies it to another file.

from sys import argv
from os.path import exists

script, from_file, to_file = argv

print "Copy the %s file to the %s file." % (from_file, to_file)

#get file size

in_file = open(from_file)
indata = infile.read()

print "The file size is %d bytes." % len(indata)

print "Ok. Does the output file exist? %r" % exists (to_file)
print "Hit return."

out_file = open(to_file, 'w')
outfile.write(indata)

out_file.close()
in_file.close()