Tcl, 84 bytes
With renaming allowed, things get shorter:
file rename i.txt m file rename -force o.txt i.txt file rename m o.txt file delete m set A [read [open i.txt]] puts [set i [open i.txt w]] [read [open o.txt]] puts [set o [open o.txt w]] $A close $i close $o