Photograph file dates

David Fletcher dave at
Sun Feb 1 16:26:34 GMT 2009

I think I might have posted this here before. It only works if you copy the 
files from the camera memory directly to the hard drive so that the date 
stamp that the camera put into the file properties is preserved.

My little script effectively reads the camera date stamp and then uses it to 
rename the file, incorporating the date and time into the file name.

.raf is the extension my camera uses for raw files. Modify as you need, if it 
looks useful to anybody.


# Use the ls command to output the date and time stamp of each file
# and awk to pick out the date and time string and the filename
for datetimefilename in $(ls --time-style=+%Y%m%d%H%M%S -l *.jpg *.raf | 
awk '{ print $6$7 }')
  echo $datetimefilename
# Split off the file name so that I can use it for the rename operation
  echo $origfilename
  mv $origfilename t$datetimefilename

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : 

More information about the kubuntu-users mailing list