Copying one directory into another Mac Catalina
I have two directories:
~/old
~/new
Each has subdirectories. What I would like to do, is copy old into new, and overwrite everything. When I do:
cp -r ~/new ~/old
It creates:
~/old/new
I tried different things, such as:
cp -r ~/new/*/* ~/old/*.*
cp -r ~/new/*/* ~/old
~/old and ~/new have very similar subfolders structure, and mostly the same file names, but I want it all overwritten. Any ideas?
Solution 1:
I think this should do it.
cp -R ~/old/ ~/new/
Note that this command copies everything in the old directory into the new directory overwriting anything that already exists in the new directory as you state in your OP.
P.S. See the comments below about why the use of -R
is recommended instead of -r
while both may work the same in your case.