On 01.05.2017 20:18, Mark Trickett via luv-main wrote:
hello All,
I have photos from my mobile phone, an old Nokia 6021, and readily get
them onto the PC. The problem is the naming, the first eight
characters are the date, two digits for the day, two for the month
then four for the year. I wish to reorder them to be year, month and
then day. That portion of the filename is then followed by brackets
with a three digit sequence number for the second and subsequent
photos on the day. it would be good to add the brackets with three
zeros when not present. That is followed by a period and the jpg
extension.
This will let me order by date when viewing in Image Viewer, and a
relatively sane sorting of the filenames. There are something over 450
images in the directory that I wish to edit the names of, so better to
get the PC to do the repetitive work.
My shell programming, and the like, are rusty, what there is of such
skills. I would appreciate some assistance and pointers.
Regards,
Mark Trickett
_______________________________________________
luv-main mailing list
[email protected]
https://lists.luv.asn.au/cgi-bin/mailman/listinfo/luv-main
Below is my answer to your problem although it probably will not suit
without modifacation. I have a couple Of Nikons (a D700 and a D810) they
produce filenames like DSC_0829.NEF. I wanted them to be in a Date and
time format for the reasons you mentioned. I ended up with a filename
like 20081106_132142-0829.png. I kept the cameras sequence number is the
D700 is capable of around 6 frames per second, and this of course would
produce identical file names for shots within the same second, The date
and time comes from data within the image and is extracked by exiv2,
using this garuntees the time is correct according to the camera.
Cut here.................................................
#! /bin/bash
# this is a script to take the file names from the camera and rename
them to Date and time of
# creation
# ls *.nef --color=never -l | cut -c 33-45,50-57 | tr '\040' '\137'
#NAME=$(ls $1 --color=never -l | cut -c 33-45,50-57 | tr '\040' '\137')
LIST=`ls --color=never *.nef`
echo $LIST
COUNTER=1
for i in $LIST
do
# echo $i
# NAME=$(ls $i --color=never -l | cut -c 35-47,52-59 | tr '\040'
'\137' | tr '\072' '\055')
NAME1=$(ls $i --color=never -l | cut -c 52-59 | tr '\040' '\137'
| tr -d '\072')
NAME=$(exiv2 $i | grep timestamp | cut -c 19-37 | tr -d '\072' |
tr '\040' '\137')
echo $NAME-$NAME1
cp $i $NAME-$NAME1
done
------------------------------end cut------------------------------
Lindsay
_______________________________________________
luv-main mailing list
[email protected]
https://lists.luv.asn.au/cgi-bin/mailman/listinfo/luv-main