Skip to content

markryall/dir_sync

Repository files navigation

<img src=“https://secure.travis-ci.org/markryall/dir_sync.png” />

dir_sync

Produce a script to synchronise two directories. Kind of like unison but a bit simpler.

Usage

dir_sync name folder1 folder2 ...

This will output all require mkdir and cp commands that would be required to sync the folders. It will also produce the index file (~/.dir_sync/NAME) which will be used in subsequent synchronisations to detect deletions. You can then review the commands before executing them (in case they seem likely to do something undesirable). Note that files that differ only in modification time will be overwritten with the most recent one.

drain script1 script2

This simply runs each line in the specified scripts rewriting the script as each command is succesfully executed. This is just so if the script is interrupted or killed, you can resume. Note that the new file will be written to a temp file first (in case the rewriting is interrupted), each command must appear on a single line and it is likely that the command interrupted will be rexecuted.

Together, these scripts can be used as follows:

dir_sync photos /Volumes/BACKUP/sync/photos /Users/Shared/Photos | tee sync.sh
drain sync.sh

Future Plans

  • actually execute file commands perhaps with optional confirmation

  • consider introducing checksums/filesize comparisons to avoid copying identical files that

differ only in modification time.

About

bidirectional directory syncing

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages