#!/bin/sh -eu # Create a `ingest-ls` compatible file listing. # # Compatible with current versions of GNU and macOS `ls`. # # $ scripts/ls -R /some/base/path \ # | python -m metadex ingest-ls --remove-missing _ls() { if command ls -d --time-style='+%s' . >/dev/null 2>&1; then # echo 'GNU' command ls --time-style='+%s' "$@" elif command ls -d -D '%s' . >/dev/null 2>&1; then # echo 'macOS' command ls -D '%s' "$@" else # echo 'unknown' command ls "$@" fi } _ls -lnAU "$@"