Commit 4b3ca890 authored by Dmitri Popov's avatar Dmitri Popov

Improve find. Fix #4

parent b4623fe7
......@@ -6,10 +6,6 @@
# opkg install getopt bc jq curl perl-image-exiftool
# Photo and RAW file extensions
EXT="JPG"
RAW="ARW"
# Check whether the required packages are installed
if [ ! -x "$(command -v getopt)" ] || [ ! -x "$(command -v bc)" ] || [ ! -x "$(command -v jq)" ] || [ ! -x "$(command -v curl)" ] || [ ! -x "$(command -v exiftool)" ]; then
echo "Make sure that the following tools are installed on your system: getopt, bc, jq, curl, exiftool"
......@@ -101,7 +97,7 @@ echo "Transferring files..."
echo "---------------------"
echo
results=$(find "$src" -type f -iname "*.$EXT" -o -iname "*.$RAW")
results=$(find "$src" -name '*' -exec file {} \; | grep -o -P '^.+: \w+ image' | cut -d":" -f1)
lines=$(echo -e "$results" | wc -l)
for line in $(seq 1 $lines)
do
......@@ -135,7 +131,7 @@ if [ ! -z "$location" ]; then
echo "Geotagging ..."
echo "--------------"
echo
results=$(find "$target" -type f -iname "*.$EXT")
results=$(find "$target" -name '*' -exec file {} \; | grep -o -P '^.+: JPEG' | cut -d":" -f1)
lines=$(echo -e "$results" | wc -l)
for line in $(seq 1 $lines)
do
......@@ -153,7 +149,7 @@ check2=$(wget -q --spider https://api.darksky.net/)
echo "-------------------------"
echo
# Obtain and write copyright camera model, lens, and weather conditions
results=$(find "$target" -type f -iname "*.$EXT")
results=$(find "$target" -name '*' -exec file {} \; | grep -o -P '^.+: JPEG' | cut -d":" -f1)
for line in $(seq 1 $lines)
do
file=$(echo -e "$results" | sed -n "$line p")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment