Skip to content

Commit b898b8d

Browse files
fix: avoid using awk to support filenames with spaces ( see #2 )
1 parent 5de340a commit b898b8d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

save.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function do_image () {
2222

2323
echo "PARENT_DIR: $PARENT_DIR"
2424

25-
local creation_time=$(exiftool -DateTimeOriginal -d "%Y-%m-%d %H:%M:%S" "$FILE" | awk -F ': ' '{print $2}')
25+
local creation_time=$( exiftool -printFormat '$DateTimeOriginal' -DateTimeOriginal -d "%Y-%m-%d %H:%M:%S" "$FILE" )
2626

2727
local filename=$(basename "$FILE")
2828
# If creation_time is not available, try getting it from filename
@@ -54,7 +54,7 @@ function do_image () {
5454
fi
5555
fi
5656

57-
creation_time=$(exiftool -DateTimeOriginal -d "%Y-%m-%d %H:%M:%S" "$FILE" | awk -F ': ' '{print $2}')
57+
creation_time=$( exiftool -printFormat '$DateTimeOriginal' -DateTimeOriginal -d "%Y-%m-%d %H:%M:%S" "$FILE" )
5858

5959
# If creation_time is not available, move it to root
6060
if [[ "$creation_time" == "null" || -z "$creation_time" ]]; then
@@ -183,7 +183,7 @@ function do_video () {
183183
base=$(basename "$1")
184184
if [[ ! "$base" =~ $IGNORE_REGEX ]]; then
185185
echo "Processing: $1"
186-
mimetype=$(file --mime-type --no-pad $1| awk '{print $2}')
186+
mimetype=$(file --brief --mime-type "$1")
187187

188188
case $mimetype in
189189
image/*)

0 commit comments

Comments
 (0)