I have two folders /var/first/app
and /var/second/app
. I have different files within both folders and few are same. I want to merge /var/second/app
to /var/first/app
. How can I do that?
I have two folders /var/first/app
and /var/second/app
. I have different files within both folders and few are same. I want to merge /var/second/app
to /var/first/app
. How can I do that?
This should do the trick:
Use something like:
or change
cp -r
tocp -a
to preserve ownership and timestamps.You can also use
-i
to make sure what is going on. it's going to prompt you before overwriting anything.You may first backup your destination folder (just in case) :
If you don't care overwriting files :
It will copy recursively the second folder into the first one, overwriting files with same names.
If you don't want to overwrite existing files :
If all is ok, you can remove the backup :