{"id":20470441,"url":"https://github.com/pbodnar/autosyncdir","last_synced_at":"2026-04-17T22:02:12.834Z","repository":{"id":230877928,"uuid":"780082335","full_name":"pbodnar/autosyncdir","owner":"pbodnar","description":"Automatic folders synchronization based on inotifywait and rsync.","archived":false,"fork":false,"pushed_at":"2024-04-12T06:52:31.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-16T02:16:47.087Z","etag":null,"topics":["inotifywait","productivity","rsync","synchronization","utilities"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pbodnar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-31T16:49:13.000Z","updated_at":"2024-04-01T09:39:08.000Z","dependencies_parsed_at":"2024-04-12T08:09:21.905Z","dependency_job_id":null,"html_url":"https://github.com/pbodnar/autosyncdir","commit_stats":null,"previous_names":["pbodnar/autosyncdir"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pbodnar%2Fautosyncdir","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pbodnar%2Fautosyncdir/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pbodnar%2Fautosyncdir/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pbodnar%2Fautosyncdir/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pbodnar","download_url":"https://codeload.github.com/pbodnar/autosyncdir/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242034024,"owners_count":20061054,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["inotifywait","productivity","rsync","synchronization","utilities"],"created_at":"2024-11-15T14:12:53.243Z","updated_at":"2026-04-17T22:02:07.777Z","avatar_url":"https://github.com/pbodnar.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# autosyncdir\n\nA simple bash script which lets you _automatically_ synchronize one or more directories to a target folder\nwhenever files in the watched directories change.\n\nThis is a much more primitive variant of the [lsyncd][lsyncd] tool.\nUnlike `lsyncd` though, this script can also run in Cygwin terminal or in Git Bash on Windows.\n\n## Installation\n\n1. Download the `autosyncdir.sh` script to any directory on your PC.\n   You can also do that by Git-cloning the whole project.\n2. The script relies on `inotifywait` and `rsync`.\n   Parent directories of these programs need to be in the system PATH\n   (see script's source code for more details).\n3. Put the script's directory to the system PATH, so that you can run it easily just by its name.\n\n## Usage\n\nSimply run the script without any parameters in order to get the basic usage help.\n\nPress \u003ckbd\u003eCtrl+C\u003c/kbd\u003e at any time to terminate the script.\n\n_On Windows_, you will typically run the script from Git Bash (\"a customized distro of MSYS2\";\npart of Git for Windows), or Cygwin terminal.\n\n### Ad-hoc script usage\n\nYou can run the script directly for an ad-hoc usage.\n\n_On Windows:_\n\n```text\n$ autosyncdir.sh 'c:\\path\\to\\source_dir1\\' 'c:\\path\\to\\source_dir2\\' 'c:\\path\\to\\target_dir'\n$ # an alternative with forward slashes:\n$ # autosyncdir.sh c:/path/to/source_dir1/ c:/path/to/source_dir2/ c:/path/to/target_dir\n# Starting the sync loop\n# Syncing...\nsending incremental file list\n\nsent 98 bytes  received 12 bytes  220.00 bytes/sec\ntotal size is 13  speedup is 0.12\n# Waiting for changes...\n===\u003e Watching c:\\path\\to\\source_dir1\\ -r*.* for create, modify, delete, move\n===\u003e Watching c:\\path\\to\\source_dir2\\ -r*.* for create, modify, delete, move\n```\n\n_On Linux:_\n\n```text\n$ autosyncdir.sh /path/to/source_dir1/ /path/to/source_dir2/ /path/to/target_dir\n# Starting the sync loop\n# Syncing...\nsending incremental file list\n\nsent 98 bytes  received 12 bytes  220.00 bytes/sec\ntotal size is 13  speedup is 0.12\n# Waiting for changes...\n===\u003e Watching /path/to/source_dir1/ -r*.* for create, modify, delete, move\n===\u003e Watching /path/to/source_dir2/ -r*.* for create, modify, delete, move\n```\n\n### Persisted script usage\n\nUsually, you will want to prepare another script where you can persist\nall what you need to synchronize.\n\nHere is an example of such a script (name it e.g. `sync_my_dirs.sh`).\n\n_On Windows:_\n\n```bash\n#!/bin/bash\n\n# Starts to automatically watch and sync all my directories.\n\nserver_cfg='c:\\server1\\cfg'\n\nautosyncdir.sh 'c:\\project1\\env\\devel\\' $server_cfg'\\project1' \u0026\nautosyncdir.sh 'c:\\project2\\env\\devel\\' $server_cfg'\\project2' \u0026\n\nwait\n```\n\n_On Linux:_\n\n```bash\n#!/bin/bash\n\n# Starts to automatically watch and sync all my directories.\n\nserver_cfg=~/server1/cfg\n\nautosyncdir.sh ~/project1/env/devel/ $server_cfg/project1 \u0026\nautosyncdir.sh ~/project2/env/devel/ $server_cfg/project2 \u0026\n\nwait\n```\n\n### Passing custom options to inotifywait and rsync\n\nYou can override options which are passed by the script to `inotifywait` and `rsync`\nby setting environment variables as in the following example.\n\n```bash\n#!/bin/bash\n\n# default: \"-r\" (recursive)\nexport INOTIFYWAIT_OPTS=\" \"\n\n# WARNING: Be careful with the --delete option, as it will delete missing files in the target directory!\n# default: \"-avz\" (archive, verbose, compress)\nexport RSYNC_OPTS=\"-avz --delete\"\n\nautosyncdir.sh /path/to/source_dir /path/to/target_dir\n```\n\n[lsyncd]: hhtps://github.com/lsyncd/lsyncd\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpbodnar%2Fautosyncdir","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpbodnar%2Fautosyncdir","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpbodnar%2Fautosyncdir/lists"}