bin/rsync-file-pattern @ 4673e928c08e
Split Stump config
author |
Steve Losh <steve@stevelosh.com> |
date |
Tue, 19 Mar 2024 13:55:42 -0400 |
parents |
5dd4e6c93b90 |
children |
(none) |
#!/usr/bin/env bash
set -euo pipefail
# USAGE: rsync-file-pattern PATTERN SOURCE DEST
# rsync-file-pattern '*.ipynb' ./ vm:path/to/foo/
# Goal: given a source and dest, sync any files inside the source that match
# a given pattern. Rsync's syntax for this is utterly deranged, so I'm making
# a script so I don't have to search for this every time.
pattern="$1"
shift
source="$1"
shift
dest="$1"
shift
rsync -av \
--prune-empty-dirs \
--include='*/' \
--include="$pattern" \
--exclude='*' \
"${source}" "${dest}" \
"$@"