copy_dir becomes copy_path and handles both files and directories