| 1 |
#!/usr/bin/env sh |
| 2 |
|
| 3 |
# Description: Simple script to give copy-paste a progress percentage |
| 4 |
# by utilizing rsync. |
| 5 |
# |
| 6 |
# LIMITATION: this won't work when pasting to MTP device. |
| 7 |
# |
| 8 |
# Dependencies: rsync |
| 9 |
# |
| 10 |
# Shell: POSIX compliant |
| 11 |
# Author: Benawi Adha |
| 12 |
|
| 13 |
sel=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection} |
| 14 |
|
| 15 |
# Choose one of these two schemes by commenting |
| 16 |
|
| 17 |
# more verbose |
| 18 |
xargs -0 -I % rsync -ah --progress % "$PWD" < "$sel" |
| 19 |
|
| 20 |
# less verbose |
| 21 |
# xargs -0 -I % rsync -ah --info=progress2 % "$PWD" < "$sel" |
| 22 |
|
| 23 |
# Clear selection |
| 24 |
if [ -p "$NNN_PIPE" ]; then |
| 25 |
printf "-" > "$NNN_PIPE" |
| 26 |
fi |