- Shell 100%
| .sync-example | ||
| README.md | ||
| rtransfer | ||
rTransfer
A command line tool used to simplify rsync commands while also providing guardrails and feedback to make sure commands are accurate.
Features:
- POSIX Friendly to work on most shells
- Create easy to read and fill out dot-files (.sync-) for each rsync command to be run
- Uses rsync's dry run feature to preview transfers
- Run multiple dot-files together
- Support for SSH/remote transfers
- Skip dry run mode option
- Reverse file transfer direction option
- Feedback for many common errors to reduce unexpected issues
- Quickly backup and restore to a
.sync-backup/directory in the current working directory
Usage Examples
Create a new .sync-* template file
rtransfer -c
Open the created file with your prefered text editor and enter information as needed
Run an individual file
rtransfer /home/example_user/.sync-example
Run an individual file (reverse transfer direction)
rtransfer -r /home/example_user/.sync-example
Run multiple files
rtransfer /home/example_user/.sync-example_1 /home/user/.sync-example_2
rtransfer /home/example_user/.sync-*
Quickly backup the current working directory (creates .sync-backup/ directory)
rtransfer -b
Quickly restore the current working directory (from previously created .sync-backup/ directory)
rtransfer -br
Dry run only mode
rtransfer -d /home/example_user/.sync-example
Dry run mode only (reverse transfer direction)
rtransfer -dr /home/example_user/.sync-example
Skip dry run mode
rtransfer -q /home/example_user/.sync-example
Skip dry run mode (reverse transfer direction)
rtransfer -qr /home/example_user/.sync-example
Setup
Run the command chmod +x /home/example_user/rtransfer to make rTransfer executable.
Optional: Place the rtransfer file into /usr/bin/ directory to use the script as a shell command
Enable File Transfers
Since this script involves the transfer of files, there is the risk of data loss. By default all transfers are disabled twice. Once in the main script and once in the created dot-files (.sync-).
The script will run in dry run mode until file transfers are enabled by doing the following:
- To enable file transfers in the main script, open the
rtransferfile in your prefered text editor and change the variable_ENABLE_TRANSFER="0"to_ENABLE_TRANSFER="1" - To enable file transfers in the dot-file, open the created
.sync-file in your prefered text editor and change the variableENABLE_TRANSFER="0"toENABLE_TRANSFER="1"
After these steps are taken, you are free to transfer files at your own risk.