On Sat, Jul 10, 2021 at 15:26 (+0000), dep via tde-users wrote:
said Steven D'Aprano via tde-users:
> On Thu, Jul 08, 2021 at 11:38:58PM +0000, dep via tde-users wrote:
>> Is there any way to have a column heading in a file manaher -- I
>> prefer Krusader, but Konqueror if I must -- list a file's creation
>> date rather than its modified date?
> Linux file systems don't record the file
creation date.
Well, that kinda sucks. EXIF maintains a creation date
that's accessible
from numerous photo applications, but those applications are universally
awful for file-management purposes. Maybe there's a script someplace that
will overright modified date with creation date. Not a thing everyone
would want to do, but useful in a variety of circumstances.
--
dep
In case this is useful to you... it is a little script that sets the
modification time of a JPEG to its EXIF time (which would then give
you the date you seem to want in your file manager). If you save it
to a file called "set-photo-time" and give it execute perms, then you
can run it as follows:
set-photo-time file1.jpg file2.jpg file3.jpg file4.jpg ...
It requires the "exif" program, which you may or may not already have
installed. It works for me, but use at your own risk.
Cheers.
Jim
#! /bin/sh
# For each JPEG argument, set the (Unix) time recorded in the EXIF
# data (if any) to the Date/Time in the file.
# Note that both "exif" and "exif.pl" give three times:
# (a) non-annotated, (b) "original", (c) "digitized".
# Exiftool gives (a) "Modify Date", (b) "Date/Time Original", (c)
"Create Date"
#
# The code below uses "exif" and the non-annotated date.
for i in "$@"
do
date=`exif "$i" 2>/dev/null | grep 'Date and Time ' \
| sed -e "s/.*|//" -e "s/[ :]//g" -e
"s/\(.*\)\(..\)/\1.\2/"`
if [ "z$date" = "z" ]
then
echo "${i}: has no EXIF data and time" 1>&2
else
echo "${i}: has date $date"
touch -t $date "$i"
fi
done