Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1 Le 07/02/2012, à 14:29

thesab

Help with a script

Hello everybody,

Here is the situation. The SD card of my camera was corrupted and I succesfully recovered the pictured by using an amazing opensource freeware called Photorec(http://www.cgsecurity.org/wiki/PhotoRec).
Pb is that I recovered much much more pics than I though and that recovered files have been renamed kind of randomly.
I found a tool Exiv2(http://www.exiv2.org/) able to read the metadate of my files: output similar to :

~# exiv2 -p s 1.jpg
Filename        : 1.jpg
Filesize        : 1285238 Bytes
Camera make     : FUJIFILM
Camera model    : FinePix F601Z
Image timestamp : 2005:08:07 14:31:22
Image number    :
Exposure time   : 1/70 s
Aperture        : F3.5
Exposure bias   : 0
Flash           : No, auto
Flash bias      :
Focal length    : 6.1 mm
Subject distance:
ISO speed       : 200
Exposure mode   : Auto
Metering mode   : Matrix
Macro mode      : Off
Image quality   : NORMAL
Exif Resolution : 2736 x 1824
White balance   : Auto
Thumbnail       : JPEG, 9612 Bytes
Copyright       :
Exif comment    :

I would like now to write a scipt to do the following:

for each jpg file in the folder:
1) run exiv2 to get the ImageTimeStamp
2) rename the file with the ImageTimeStamp

That would help me to then select the pics I want to keep.

If anyone can indicate me how I can do this I would be grateful.

Thank you in advance

Hors ligne

#2 Le 07/02/2012, à 14:48

Bousky

Re : Help with a script

Pourquoi un message en anglais tout à coup alors que tu as déjà posté, et en français ?


Linux qui plante complètement ? Plus rien ne répond ? On peut toujours le redémarrer proprement :
Alt + SysRq + REISUB (Retourne En Islande Sur Un Bateau !)

Hors ligne

#3 Le 07/02/2012, à 14:58

thesab

Re : Help with a script

En fait j'ai aussi poste sur un site linux anglophone et j'ai juste recopie le texte ici.
Si necessaire j'essayerais de mettre le post en francais un peu plus tard dans la journee.

Dernière modification par thesab (Le 07/02/2012, à 15:23)

Hors ligne

#4 Le 07/02/2012, à 15:20

Bousky

Re : Help with a script

C'était plus par curiosité…

Tu as essayé avec « exiv2 mv <fichiers> » ? c.f. « man exiv2 »


Linux qui plante complètement ? Plus rien ne répond ? On peut toujours le redémarrer proprement :
Alt + SysRq + REISUB (Retourne En Islande Sur Un Bateau !)

Hors ligne

#5 Le 07/02/2012, à 15:28

pingouinux

Re : Help with a script

Bonjour,
Essayer ceci, en enlevant echo si c'est bon :

for i in *.jpg
do
   lig=$(exiv2 -p s "$i" | grep 'Image timestamp')
   timestamp=$(sed 's/^.*: \(.*\) \(.*\)$/\1-\2/' <<<"$lig")
   echo mv "$i" $timestamp.jpg
done

Ajouté : La méthode de Bousky #4 est plus simple

Dernière modification par pingouinux (Le 07/02/2012, à 15:35)

Hors ligne

#6 Le 07/02/2012, à 15:29

thesab

Re : Help with a script

J'ai lu le man page hier mais je devais être très fatigue car j ai loupe cette option qui a l'air de faire exactement ce que je veux.
Je suis au travail mais j'essayerais des ce soir !!
Merci

Hors ligne