This commit is contained in:
2022-01-07 18:07:25 -08:00
parent a9590c0dce
commit bab7810cd3
22 changed files with 114606 additions and 1 deletions

23
bin/file-by-date Executable file
View File

@@ -0,0 +1,23 @@
#!/bin/bash
set -x
for FN in *; do
if [[ -f "$FN" ]]; then
MTIME="$(stat -f "%Sm" "$FN")"
if [[ ! -z "$MTIME" ]]; then
# eg "Sep 13 05:02:26 2019"
YYYY="$(date -j -f "%b %d %T %Y" "$MTIME" "+%Y")"
MM="$(date -j -f "%b %d %T %Y" "$MTIME" "+%m")"
DD="$(date -j -f "%b %d %T %Y" "$MTIME" "+%d")"
TD="${YYYY}/${YYYY}-${MM}/${YYYY}-${MM}-${DD}"
if [[ ! -d ./"$TD" ]]; then
mkdir -p ./"$TD"
fi
if [[ ! -e ./"${TD}"/"$FN" ]]; then
mv ./"$FN" ./"$TD"/"$FN"
echo mv ./"$FN" ./"$TD"/"$FN"
fi
fi
fi
done