1

How to replicate a directory in Linux [closed]

view story
linux-howto

http://stackoverflow.com – I have 2 directories DIR1 contains file1, file2 DIR2 contains file1, file3 Is there a way to replicate DIR1 to DIR2. means, if i give, cp -r DIR1/* DIR2 file1 in DIR2 gets replaced with file1 in DIR1. file2 in gets copied to DIR2. file3 remains untouched. But, i need DIR2 to be the exact replica of DIR1. Am i left with option like, rm -rf DIR2 cp -r DIR1/* DIR2 Or, is there a way to achieve this replication? (HowTos)