I need to do a directory sync e.g. from /dir-a/
to /dir-b/
(always in this direction). However, there are two requirements:
- There is a particular subdirectory
/dir-a/.dont-copy/
(yes, started with a.
) that I should ignore. That is,/dir-a/.dont-copy/
should always stay in/dir-a/
, never move. - Files / directories in
/dir-b/
that don't exist in/dir-a/
should be deleted.
How would I do this using command-line tools (ideally, on Mac OSX)? Thanks beforehand for your help!
try:
Note the trailing slash on dir-a. If you omit that, you will get dir-b/dir-a.