Improved file copying when the destination is a directory