This is not a problem as much as my curiosity of the different cp -r behavior. This is on the latest Ubuntu. I have an outdated copy in a directory with several subdirectories. I'd like to update the outdated copy by simply overwriting the directory with the newer one. New files are added and same file are simply overwritten.
So at first I did:
$cp -r <path>/curr_dir <path>/destination_dir
New files in curr_dir are added but same_name files are not updated, hmm?
But, if I:
$cd <path>/curr_dir
$cp -r * <path>/destination_dir/
Then the newer files are added and the outdated files are overwritten.
Why this difference? I checked my .bashrc and my .profile and I don't see any special aliasing of the cp command.
Surely I'm missing something. Any comments, thoughts?
Thanks
curr_dir
intodestination_dir/curr_dir
.curr_dir/a
, then the former will copy that todestination_dir/curr_dir/a
, the latter todestination_dir/a
.cp -r dir otherdir
andcp -r dir/* otherdir
. The former copies the directory, the latter the files and subdirectories in the directory.dir
vs.dir/
makes no difference.