images_copy: Hopefully fix.

This commit is contained in:
William Floyd 2020-05-06 23:32:30 -04:00
parent 0effef89f5
commit d0e82e6bfc
Signed by untrusted user who does not match committer: william
GPG key ID: B3EEEDD81893CAF9

View file

@ -1,5 +1,9 @@
#!/bin/bash
__list='clickbait
midiMixer/v1
midiMixer/handwired'
__target_prefix='./static/images'
__source_prefix='../blog-images/dirs'
@ -15,27 +19,36 @@ __copy() {
__target="${1}"
__source="${2}"
if [ -d "${__target}" ]; then
rm -r "${__target}"
if ! [ -d "${__target}" ]; then
mkdir -p "${__target}"
fi
mkdir -p "$(dirname "${__target}")"
while read -r __file; do
cp -r "${__file}" "${__target}"
done < <(find "${__source}" -maxdepth 1 -type f -iname '*.jpg')
}
__func() {
__copy_wrapper() {
__copy_reduced "${1}"
__copy_original "${1}"
}
__func 'clickbait'
__clean() {
__target="${1}"
__source="${2}"
__func 'midiMixer/v1'
if [ -d "${__target}" ]; then
rm -r "${__target}"
fi
}
__func 'midiMixer/handwired'
while read -r __dir; do
__clean "${__dir}"
done <<<"${__list}"
while read -r __dir; do
__copy_wrapper "${__dir}"
done <<<"${__list}"
exit