As part of a personal project I have generated a large number of frames.
I want to rename around 6000 png image files in terminal so that within the name they have the time that the frame represents.
eg
Frame_0001.png to Frame_DDMMYY_HHMMSS.png
Frame_0001.png to Frame_201114_134612.png Frame_0002.png to Frame_201114_134613.png and so on...
The first frame starts at 13:46:12 on the 20th November 2014. I want the rest of the images to be renamed sequentially so that they are all named after the date and time they represent.
Any help is greatly appreciated.
用perl的(p)重命名:
rename -n "s/\d+/$(date +%d%m%Y_%H%M%S)/" Frame_0001.png
The way I understand your description is that each frame represents one second of a contiguous sequence.
start='13:46:12 20 November 2014'
for i in `ls Frame_????.png|sed 's/Frame_\(....\).png/\1/'`
do time=`date -d "$start - 1 second + $i seconds" +%d%m%y_%H%M%S`
mv Frame_$i.png Frame_$time.png
done
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.