HACKER Q&A
📣 amichail

Why doesn't cp have a flag to replace directories (like Finder)?


You could use rsync for this purpose, but why isn't there a flag in cp that would remove files in the destination directory that are not in the source directory?


  👤 gregjor Accepted Answer ✓
The Unix philosophy dictates that tools do one thing in a standard way. You accomplish more complicated tasks by combining tools rather than adding features to a tool, which makes it more complicated.

You can diff two directories to find files in one but not in the other, and from there rm the missing files. Or use rsync.