https://github.com/m-manu/rsync-sidekick
Propagate file renames, movements and timestamp changes before rsync runs
https://github.com/m-manu/rsync-sidekick
backups command-line-tool command-line-utility go golang media
Last synced: 2 months ago
JSON representation
Propagate file renames, movements and timestamp changes before rsync runs
- Host: GitHub
- URL: https://github.com/m-manu/rsync-sidekick
- Owner: m-manu
- License: apache-2.0
- Created: 2021-04-17T09:41:25.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2025-02-16T09:47:12.000Z (4 months ago)
- Last Synced: 2025-03-31T09:07:23.611Z (2 months ago)
- Topics: backups, command-line-tool, command-line-utility, go, golang, media
- Language: Go
- Homepage:
- Size: 78.1 KB
- Stars: 101
- Watchers: 4
- Forks: 2
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rsync-sidekick
[](https://github.com/m-manu/rsync-sidekick/actions/workflows/build-and-test.yml)
[](https://goreportcard.com/report/github.com/m-manu/rsync-sidekick)
[](https://pkg.go.dev/github.com/m-manu/rsync-sidekick)
[](./LICENSE)## Introduction
`rsync` is a fantastic tool. Yet, by itself, it's a pain to use for repeated backing up of media files (videos, music,
photos, etc.) _that are reorganized frequently_.`rsync-sidekick` is a safe and simple tool that is designed to run **before** `rsync` is run.
## What does this do?
`rsync-sidekick` propagates following changes (or any combination) from _source directory_ to _destination directory_:
1. Change in file modification timestamp
2. Rename of file/directory
3. Moving a file from one directory to anotherNote:
* This tool **does not delete** any files or folders (under any circumstances) -- that's why safe-to-use 😌
* Your files are just _moved around_
* Now, if you're uncomfortable with this tool even moving your files around, there is a `--shellscript` option, that
just generates a script for you to read and run (think of it like a `--dry-run` option)
* This tool **does not** actually **transfer** files -- that's for `rsync` to do 🙂
* Since you'd run `rsync` after this tool is run, any changes that this tool couldn't propagate would just be propagated
by `rsync`
* So the most that you might lose is some time with `rsync` doing more work than it could have -- Which is likely
still much less than not using this tool at all 😄## How to install?
1. Install Go version at least **1.22**
* On Ubuntu: `snap install go`
* On Mac: `brew install go`
* For anything else: [Go downloads page](https://go.dev/dl/)
2. Run command:
```bash
go install github.com/m-manu/rsync-sidekick@latest
```
3. Add following line in your `.bashrc`/`.zshrc` file:
```bash
export PATH="$PATH:$HOME/go/bin"
```## How to use?
**Step 1**: Run this tool
```bash
rsync-sidekick /Users/manu/Photos/ /Volumes/Portable/Photos/
```**Step 2**: Run `rsync` as you would normally do
```bash
# Note the trailing slashes below. Without them, rsync's behavior is different!
rsync -av /Users/manu/Photos/ /Volumes/Portable/Photos/
```## Command line options
Running `rsync-sidekick --help` displays following information:
```
rsync-sidekick is a tool to propagate file renames, movements and timestamp changes from a source directory to a destination directory.Usage:
rsync-sidekick [source-dir] [destination-dir]where,
[source-dir] Source directory
[destination-dir] Destination directoryflags: (all optional)
-x, --exclusions string path to file containing newline separated list of file/directory names to be excluded
(even if this is not set, files/directories such these will still be ignored: $RECYCLE.BIN, desktop.ini, Thumbs.db etc.)
-h, --help display help
--list list files along their metadata for given directory
-s, --shellscript instead of applying changes directly, generate a shell script
(this flag is useful if you want 'dry run' this tool or want to run the shell script as a different user)
-p, --shellscript-at-path string similar to --shellscript option but you can specify output script path
(this flag cannot be specified if --shellscript option is specified)
-v, --verbose generates extra information, even a file dump (caution: makes it slow!)
--version show application version (v1.5.0) and exitMore details here: https://github.com/m-manu/rsync-sidekick
```## Running this from a Docker container
Below is a simple example:
```shell
# Run rsync-sidekick:
docker run --rm -v /Users/manu:/mnt/homedir manumk/rsync-sidekick rsync-sidekick /mnt/homedir/Photos/ /mnt/homedir/Photos_backup/# Then run rsync: (note the trailing slashes -- without them, rsync's behavior is different)
docker run --rm -v /Users/manu:/mnt/homedir manumk/rsync-sidekick rsync /mnt/homedir/Photos/ /mnt/homedir/Photos_backup/
```## FAQs
### Why was this tool created?
`rsync` options such as `--detect-renamed`, `--detect-renamed-lax`, `--detect-moved` and `--fuzzy` don't work reliably
and sometimes are dangerous! `rsync-sidekick` is reliable alternative to all these options and much more.### How will I benefit from using this tool?
Using `rsync-sidekick` before `rsrync` makes your backup process significantly faster than using only `rsync`. Sometimes
this performance benefit can even be 100x😲, if the only changes at your _source directory_ are the 3 types mentioned
earlier in this article.