--- /dev/null
+#!/bin/sh
+
+for select in $(seq 1 $(POST_COUNT select)); do
+ file="$_DATA/$ITEM/$(POST select $select)"
+ meta="${file%/*}/.index/meta"
+ fn="${file##*/}"
+
+ while ! mkdir "${meta}.lock"; do
+ sleep 1
+ ps -o pid \
+ | grep -q "$(cat "${meta}.lock/pid")" \
+ || break
+ done
+ printf '%i\n' >"${meta}.lock/pid"
+
+ grep -vF " $fn" "$meta" >"${meta}.lock/mtmp"
+ read length width height tags comment x <<-EOF
+ $(grep -F " $fn" "$meta")
+ EOF
+ tags="$(printf '%s' "${tags#tags=}" | tr , '\n')"
+
+ for tn in $(seq 1 $(POST_COUNT tag)); do
+ tags="$tags${BR}$(POST tag $tn |sed -r 's;\t;\\t;g; s;\r;;g;')"
+ done
+ tags="$tags${BR}$(POST newtag |sed -r 's;\t;\\t;g;')"
+
+ printf '%s\t%s\t%s\ttags=%s\t%s\t%s\n' \
+ "$length" "$width" "$height" \
+ "$(printf %s "$tags" |sort -u |tr '\n' ,)" \
+ "$comment" "$fn" \
+ >>"${meta}.lock/mtmp"
+ mv "${meta}.lock/mtmp" "$meta"
+
+ rm "${meta}.lock/pid"; rmdir "${meta}.lock"
+done