I have a folder like this:./folder-a/index.html./folder-b/index.html./folder-c/subdir/index.html./new-content/folder-a/index.html./new-content/folder-b/index.html./new-content/folder-c/subdir/index.htmlThe new-content folder contains an on-going updated stuff that I update. When I want to update my content I am going to copy them to overwrite the existed ones, like this:\cp -rf new-content/* ./But how can I set up a backup of the going-to-be-overwritten files?Any simple way to achieve this?
How to backup all the files that I'm copying before being overwritten?
backup;cp;file copy
From man cp (the GNU version, found on Linux and Cygwin)--backup[=CONTROL]make a backup of each existing destination file-b     like --backup but does not accept an argumentExampletouch 1 2cp -bv 2 12 -> 1 (backup: 1~)Note that this does not check for existing backup files, i.e. if 1~ exists it will be overwritten. Using the long version you can avoid this. E.g.cp -v --backup=numbered 2 12 -> 1 (backup: 1.~1~)cp -v --backup=numbered 2 12 -> 1 (backup: 1.~2~)cp -v --backup=numbered 2 12 -> 1 (backup: 1.~3~)