-
Notifications
You must be signed in to change notification settings - Fork 1
/
tagthis
executable file
·32 lines (28 loc) · 887 Bytes
/
tagthis
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
# A droptarget file.
# use to add arbitrary exif tags to a given file.
#
# Create a symlink or alias to this script on your desktop or similar
# Rename the alias to the term you want to use
# Drop a media file onto this drop target
# It will add the name of the alias to the file.
term=$0
function processFile {
local source_file=$1
local exif_option="-quiet -overwrite_original"
exiftool ${exif_option} "${source_file}" -XMP:Subject-="$term" -XMP:Subject+="$term"
}
function processFiles {
for file in "$@"; do
if [[ -d $file ]]; then
# If the argument is a directory, process all files in the directory
for f in "$file"/*; do
processFile "$f"
done
else
# If the argument is a file, process the file
processFile "$file"
fi
done
}
parallalProcessFiles "$@"