#!/bin/bash
index=1
for i in `ls -U *.mp4`; do
new=$(printf "%02d.${i}" ${index})
mv ${i} ${new}
let index=index+1
done
複製代碼
-t
按最後修改時間 -U
按建立時間bash
$ man ls
-t Sort by time modified (most recently modified first) before sorting the operands by lexicographical order.
-U Use time of file creation, instead of last modification for sorting (-t) or long output (-l).
複製代碼