Tcl, 8471 bytes
With renaming allowed, things get shorter:
file renameren i.txt m file renameren -force o.txt i.txt file renameren m o.txt file deletede m 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