-list_files(){
- (cd "$_DATA/$ITEM";
- find ./ -type f -mindepth 1 -maxdepth 1 \
- -exec stat -c '%Y %n' "${f#./}" '{}' + 2>&-
- ) \
- | { [ "$(GET o)" = Date ] && sort -rn || sort -k 2; } \
- | cut -d/ -f2-
+[ "$FILTER" ] && list_fex="$(
+ fex='p'
+ STRING "$FILTER^" \
+ | sed -r 's;\^;\n;g; s;[]\/\(\)\\\^\$\?\.\+\*\;\[\{\}];\\&;g' \
+ | while read -r f; do
+ [ ! "${f#~}" ] && continue
+ [ "${f#~}" = "$f" ] \
+ && fex="/(\ttags=([^\t]*,)?)(${f})((,[^\t]*)?\t)/{${fex}}" \
+ || fex="/(\ttags=([^\t]*,)?)(${f#~})((,[^\t]*)?\t)/d; ${fex}"
+ printf '%s\n' "${fex}"
+ done \
+ | tail -n1
+)"
+
+list_filemeta(){
+ local meta base f fn file
+ base="$1"
+ meta="$1/.index/meta"
+ meta_dir "$_DATA/$ITEM/$base"
+
+ if [ "$FILTER" ]; then
+ sed -nr "$list_fex" "$_DATA/$ITEM/$meta"
+ elif [ "${SEARCH#!}" != "${SEARCH}" ]; then
+ grep -viE "$(STRING "${SEARCH#!}")" "$_DATA/$ITEM/$meta"
+ else
+ grep -iE "$(STRING "${SEARCH}")" "$_DATA/$ITEM/$meta"
+ fi |cut -f1,6- \
+ | while f="$(line)"; do
+ fn="$(UNSTRING "${f#* }")"; fn="${fn%${CR}}";
+ file="$(printf '%s\n' "$_DATA/$ITEM/$base/${fn}".*)"
+ file="${file##*/}"
+ [ -e "$_DATA/$ITEM/$base/${file}" ] \
+ && printf '%s %s\n' "${f%% *}" "${base}/${file}"
+ done