Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
URL="http://doxieflashair.local"
DIRS="/DCIM/100DOXIE"
list () {
curl -s "${URL}/command.cgi?op=100&DIR=${1}" \
| awk 'BEGIN { FS=","; OFS="/" } /.+,(.+,){3}/ { print $1,$2 }'
}
files () {
for dir in $1; do
list "$dir"
done
}
download () {
files=$@
for file in $files; do
echo -n "$file: "
mkdir -p "./$(dirname $file)"
if curl -s -o "./${file}" "${URL}/${file}"; then
echo "OK"
else
echo "FAIL"
fi
done
}
download $(files $DIRS)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment