Created
December 19, 2021 12:03
-
-
Save TatsuyaOGth/386d69f5d93258b6be51adee4b809200 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # can additional arguments | |
| # ex.: $ sh rsync_tool.sh --checksum | |
| echo "Input source directory path (no need end slash)" | |
| read SRC | |
| echo "Input destination directory path (no need end slash)" | |
| read DST | |
| echo "Input include file type (ex. '*.JPG')" | |
| read INC | |
| echo "- Source: ${SRC}" | |
| echo "- Dstination: ${DST}" | |
| echo "- Include file type: ${INC}" | |
| echo "- Custom arguments: $1" | |
| echo "=> Rsync dry run" | |
| rsync $1 -avzn --exclude=".*" --include="${INC}" --exclude="*" "${SRC}/" "${DST}/" | |
| read -p "ok? (y/N):" yn | |
| case "$yn" in [yY]*) ;; *) echo "abort." ; exit ;; esac | |
| rsync $1 -avz --progress --exclude=".*" --include="${INC}" --exclude="*" "${SRC}/" "${DST}/" | |
| echo "Done!" | |
| read -p "Any key to close" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment