您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 
hacks/bin/rename-videos-by-mtime

25 行
719 B

#!/bin/bash
# be advised: this script is dumb and you should use
# https://github.com/ayoisaiah/f2
# instead
set -x
for FN in *.MOV *.MP4 *.MTS *.mov *.mp4; do
if [[ -e "$FN" ]]; then
MTIME="$(stat -f "%Sm" "$FN")"
if [[ ! -z "$MTIME" ]]; then
# eg "Sep 13 05:02:26 2019"
NP="$(date -j -f "%b %d %T %Y" "$MTIME" "+%Y-%m-%dT%H%M%S")"
EXT="${FN##*.}"
LOWEREXT="$(echo "$EXT" | tr 'A-Z' 'a-z')"
TARGET="$NP.$LOWEREXT"
if [[ -e "$FN" ]]; then
if [[ ! -e "$TARGET" ]]; then
mv "$FN" "$TARGET"
echo mv "$FN" "$TARGET"
fi
fi
fi
fi
done