create a file copy funciton