17
2
Say I have two folders with various content, foo
and bar
. How can I merge bar
into foo
so that:
- Files in
foo
that are not inbar
are untouched. - Files in
bar
that are not infoo
are now infoo
. - Files in
foo
that are also inbar
have been replaced by the files frombar
.
1Note: it will omit hidden files/directories in
bar
(i.e. with names starting with a dot –.
) because of how shell globbing works. – Kamil Maciorowski – 2017-06-15T17:10:35.953Yeah, what I was uncertain about was the recursiveness and how to not end up with just having bar inside foo as foo/bar. But this seems to be what I want :) – Svish – 2011-02-07T12:57:37.570
1Right, if you just did
cp -R /path/to/bar /path/to/foo
it would create a directorybar
insidefoo
. Subtle point. – coneslayer – 2011-02-07T13:20:48.750