Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/helinwang/sync_mv
https://github.com/helinwang/sync_mv
Last synced: 8 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/helinwang/sync_mv
- Owner: helinwang
- Created: 2022-12-16T15:54:39.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2022-12-29T16:44:58.000Z (almost 2 years ago)
- Last Synced: 2024-10-31T11:33:34.610Z (14 days ago)
- Language: Rust
- Size: 35.2 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# sync_mv
## Overview
Generates a script containing `mkdir` and `mv` commands that moves the files in the `dst` folder to
match the file structure of the `src` folder.This utility is helpful for avoiding file copy (often from a remote computer) when using `rsync` and
the files in the `src` folder have been moved:1. It detects a file that have been moved in `src` that already existing in `dst`, and generate a
`mv` command to move the file.2. It detects duplication with file size and modified date. So it's assuming `rsync` is copying the
file attributes over. E.g., using `rsync -a`.3. By default files smaller than 1MB is ignored, since copying them with `rsync` does not add much
time. The threshold can be controlled by the `--min-file-size` flag.4. All symlinks are ignored.
Command:
```bash
sync_mv --action digest --folder source_folder --min-file-size 1000000 > src.json
# or: ssh user@host_ip '/home/user/sync_mv --action digest --folder source_folder --min-file-size 1000000' > src.json
sync_mv --action digest --folder destination_folder --min-file-size 1000000 > dst.json
sync_mv --action diff --src src.json --dst dst.json > diff.txt
```The above command generates a diff.txt containing the command to run. You can inspect the file and
run it and then optionally sync the folders with `rsync`. E.g.,```bash
bash diff.txt
rsync -avh source_folder destination_folder
```## Installation
1. [install cargo](https://doc.rust-lang.org/cargo/getting-started/installation.html)
2. run `cargo install sync_mv`## License
MIT