import shutil import tempfile src = tempfile.mktemp('.dat') f = open(src, 'wb') f.write('hello') f.close() shutil.copy(src, 'C:\\Temp\\test.copy')