Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Recursive whisper data file back-fill script using carbonate::whisper-fill
#!/bin/bash
set -eo pipefail
if [ "$#" -lt 2 ]
then
>&2 echo 'Usage: whisper-back-fill.sh SOURCE_BASE_DIR DESTINATION_BASE_DIR'
>&2 echo 'e.g. given './data/dal05': whisper-back-fill.sh ./data /data/graphite/storage/'
exit 1
fi
SOURCE_DIR="$1"
DEST_DIR="$(realpath -s "$2")"
shopt -s globstar nullglob
for FILE in "${SOURCE_DIR}"/**/*.wsp
do
DEST_PATH="${DEST_DIR}/${FILE}"
if [ -f "${DEST_DIR}/${FILE}" ]
then
whisper-fill "${FILE}" "${DEST_PATH}"
else
mkdir -p "$(dirname "${DEST_PATH}")"
cp "${FILE}" "${DEST_PATH}"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment