Command line
syncdir
Global install gives you syncdir. Source and target can be relative or absolute. Watch is off until you pass -w.
npm i sync-directory -g
syncdir <from> <to> [options]
syncdir ./aaa ./bbb -wFlags
| Flag | API equivalent | Default | What it does |
|---|---|---|---|
-w, --watch | watch | false | Keep syncing as files change. |
--quiet | — | false | Hide non-essential logs. |
--exclude <strings...> | exclude | — | Skip paths, e.g. syncdir a b --exclude node_modules package-lock.json |
-si, --skipInitialSync | skipInitialSync | false | Do not copy the tree first; only watch later events. |
-nd, --nodeep | nodeep | false | Only the first level of files and folders. Useful on huge trees. |
-do, --deleteOrphaned | deleteOrphaned | false | Delete target files that are gone (or excluded) from source. |
-hardlink, --hardlink | type: 'hardlink' | copy | Create hardlinks instead of copying bytes. |
-symlink, --symlink | staySymlink | false | Preserve symlink folders as the same symlink in the target. |