Kotlin copy file

This is an infinite loop. You need to update length.