Tu sélectionnes ta photo en cliquant dessus puis en maintenant le clic tu glisses sur la fenêtre du terminal ! En lâchant le clic , le chemin de la photo s'affiche dans le terminal et la tu valides.
Bonjour,
Tu as lancé quel script ? que je vois je qui cloche !.
De plus si tu pouvais décrire exactement ce que tu fais.
-- remplace date du fichier par la date exif creation
tell application "Finder"
    set Chemin to choose folder with prompt "Sélectionnez le dossier contenant les fichiers à redater"
    my inspecter(Chemin)
end tell
on inspecter(un_dossier)
    tell application "Finder"
        -- traitement des fichiers :
        set les_fichiers to files of un_dossier
        repeat with chaque_fichier in les_fichiers
            -- traitement d'un fichier
            set chaque_fichier to chaque_fichier as string
            
            
            try
                set datephoto to do shell script "/usr/local/bin/exiftool -CreateDate " & quoted form of POSIX path of chaque_fichier -- avec exiftool installé
                
            on error
                set datephoto to ""
            end try
            
            
            if length of datephoto > 20 then
                set DateOriginale to text -20 thru -1 of datephoto
                set ladate to text 1 thru -16 of DateOriginale
                set ladate to ladate & text 7 thru -13 of DateOriginale
                set ladate to ladate & text 10 thru -10 of DateOriginale
                set ladate to ladate & text 13 thru -7 of DateOriginale
                set ladate to ladate & text 16 thru -4 of DateOriginale
                set ladate to ladate & "." & text 19 thru -1 of DateOriginale
                
                set xxx to ladate as string
                if xxx is not " 000000000000.00" then
                    do shell script "touch -t " & ladate & " " & quoted form of POSIX path of chaque_fichier
                end if
            end if
            
            
        end repeat
        
        -- traitement des dossiers :
        set les_dossiers to folders of un_dossier
        repeat with chaque_dossier in les_dossiers
            -- traitement d'un dossier
            my inspecter(chaque_dossier)
        end repeat
    end tell
    
end inspecter
tell application "Finder"
    (display dialog ("waouou ... Ca y est c'est fait !") buttons {"Salut !"})
end tellmerci pour la réponse. effectivement, après analyse, il s'agissait de certains fichiers qui n'avaient aucune "encoded date". Je les ai rajouté avec ffworks (super outil que je recommande, même si payant). Merci encore pour le script, top !Bonjour,
Le nombre de fichiers n'a rien à voir.
Le script que j'ai adapté pour les vidéos pose des problèmes pour certains fichiers vidéo.
En effet les fichiers vidéo ont des structures différentes en fonction de leurs origines. codecs vidéo, codecs audio et les 2 empaquetés dans un conteneur. Ils n'ont donc pas tous la date de création renseignées de la même manière, donc difficile d'avoir une solution universelle.
Pour analyser le problème il faudrait voir avec un des fichiers qui provoque l'erreur et regarder avec exiftool comment est renseigné la date.
-- remplace date du fichier par la date exif creation
tell application "Finder"
    set Chemin to choose folder with prompt "Sélectionnez le dossier contenant les fichiers à redater"
    my inspecter(Chemin)
end tell
on inspecter(un_dossier)
    tell application "Finder"
        -- traitement des fichiers :
        set les_fichiers to files of un_dossier
        repeat with chaque_fichier in les_fichiers
            -- traitement d'un fichier
            set chaque_fichier to chaque_fichier as string
            
            try
                set datephoto to do shell script "/usr/local/bin/exiftool -DateTimeOriginal " & quoted form of POSIX path of chaque_fichier
                if datephoto is "" then set datephoto to do shell script "/usr/local/bin/exiftool -CreateDate " & quoted form of POSIX path of chaque_fichier
                
                
            on error
                -- Ecrit un fichier erreur sur le bureau si erreur chargement date
                set lelog to open for access ((path to desktop folder as text) & "les erreurs.txt") as text with write permission
                write "Le fichier ne contient pas de date  : " & chaque_fichier & return to lelog starting at eof
                close access lelog
                
                set datephoto to ""
            end try
            
            if length of datephoto > 20 then
                set x to (length of datephoto) - 33
                set DateOriginale to text -x thru -1 of datephoto
                
                set ladate to text 1 thru 5 of DateOriginale
                set ladate to ladate & text 7 thru 8 of DateOriginale
                set ladate to ladate & text 10 thru 11 of DateOriginale
                set ladate to ladate & text 13 thru 14 of DateOriginale
                set ladate to ladate & text 16 thru 17 of DateOriginale
                set ladate to ladate & "." & text 19 thru 20 of DateOriginale
                
                set xxx to ladate as string
                
                if xxx is " 000000000000.00" then
                    -- Ecrit un fichier erreur sur le bureau si erreur chargement date(=0000...)
                    set lelog to open for access ((path to desktop folder as text) & "les erreurs.txt") as text with write permission
                    write "Le fichier ne contient pas de date : " & chaque_fichier & return to lelog starting at eof
                    close access lelog
                else
                    do shell script "touch -t " & ladate & " " & quoted form of POSIX path of chaque_fichier
                end if
            end if
            
            
        end repeat
        
        -- traitement des dossiers :
        set les_dossiers to folders of un_dossier
        repeat with chaque_dossier in les_dossiers
            -- traitement d'un dossier
            my inspecter(chaque_dossier)
        end repeat
    end tell
    
end inspecter
tell application "Finder"
    (display dialog ("waouou ... Ca y est c'est fait !") buttons {"Salut !"})
end tellencore mieux, merci!Bonjour,
Afin de voir un peu plus clair, j'ai modifié le script qui maintenant crée un log sur le bureau avec la liste des fichiers pour lesquels il n' a pas trouver de date (ni dans TimeDateOriginal ni dans CreateDate)
le script modifié:
Bloc de code:-- remplace date du fichier par la date exif creation tell application "Finder" set Chemin to choose folder with prompt "Sélectionnez le dossier contenant les fichiers à redater" my inspecter(Chemin) end tell on inspecter(un_dossier) tell application "Finder" -- traitement des fichiers : set les_fichiers to files of un_dossier repeat with chaque_fichier in les_fichiers -- traitement d'un fichier set chaque_fichier to chaque_fichier as string try set datephoto to do shell script "/usr/local/bin/exiftool -DateTimeOriginal " & quoted form of POSIX path of chaque_fichier if datephoto is "" then set datephoto to do shell script "/usr/local/bin/exiftool -CreateDate " & quoted form of POSIX path of chaque_fichier on error -- Ecrit un fichier erreur sur le bureau si erreur chargement date set lelog to open for access ((path to desktop folder as text) & "les erreurs.txt") as text with write permission write "Le fichier ne contient pas de date : " & chaque_fichier & return to lelog starting at eof close access lelog set datephoto to "" end try if length of datephoto > 20 then set x to (length of datephoto) - 33 set DateOriginale to text -x thru -1 of datephoto set ladate to text 1 thru 5 of DateOriginale set ladate to ladate & text 7 thru 8 of DateOriginale set ladate to ladate & text 10 thru 11 of DateOriginale set ladate to ladate & text 13 thru 14 of DateOriginale set ladate to ladate & text 16 thru 17 of DateOriginale set ladate to ladate & "." & text 19 thru 20 of DateOriginale set xxx to ladate as string if xxx is " 000000000000.00" then -- Ecrit un fichier erreur sur le bureau si erreur chargement date(=0000...) set lelog to open for access ((path to desktop folder as text) & "les erreurs.txt") as text with write permission write "Le fichier ne contient pas de date : " & chaque_fichier & return to lelog starting at eof close access lelog else do shell script "touch -t " & ladate & " " & quoted form of POSIX path of chaque_fichier end if end if end repeat -- traitement des dossiers : set les_dossiers to folders of un_dossier repeat with chaque_dossier in les_dossiers -- traitement d'un dossier my inspecter(chaque_dossier) end repeat end tell end inspecter tell application "Finder" (display dialog ("waouou ... Ca y est c'est fait !") buttons {"Salut !"}) end tell
Ca ne fera pas avancer la conversation, mais je voulais vous remercier !! Vous venez de sauver la mise, et de me permettre de traiter plus de 15000 images qui n’avaient plus de date et qui étaient mélangées sans solution pour les reclasser... Je ne peux (Et ne veux) pas utiliser IPhoto heureusement que j’ai trouvé ce filContent pour toi ! Bonne journée et bonne fêtes de fin d’année
 
	