Inline copy_dir into copy function