single method for copying files