mercredi 14 janvier 2015

How to a folder by another, but NOT by merging/adding


I am doing backups of a directory with a simple:



cp -R /production/directory /backups/location


Sometimes I need to restore a backup, but doing:



cp -R /backups/location/* /production/directory


or



cp -RT /backups/location /production/directory


has the unwanted (in my case) effect, of keeping files present in /production/directory but not in the backup, while I want them removed, to get things in the exact same state as when the backup was done.


Is there any magic switch, or other simple command, to perform that, or do I need to manually remove the whole directory first ?



Aucun commentaire:

Enregistrer un commentaire