按时间的创建/修改顺序重命名文件

·  阅读 859
#!/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 按创建时间

$ 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).
复制代码
分类:
阅读
标签:
分类:
阅读
标签:
收藏成功!
已添加到「」, 点击更改