Implement the replace-file functionality

`evt` should probably be `ev` here.