![]() |
purge_non_existing_images.sh - Version imprimable +- Forum darktable FR (https://forums.darktable.fr) +-- Forum : Utilisation de darktable (https://forums.darktable.fr/forumdisplay.php?fid=97) +--- Forum : Module Table Lumineuse (https://forums.darktable.fr/forumdisplay.php?fid=74) +--- Sujet : purge_non_existing_images.sh (/showthread.php?tid=3608) |
purge_non_existing_images.sh - PSIFWI - 08-05-19 Bonjour, Je souhaite supprimer toutes les miniatures avec tête de mort..... J'ai bien lancer de différentes façons le script purge_non_existing_images.sh. J'ai rendu le fichier exécutable, et aussi essayer de lancer par terminal, ça ne fonctionne pas .... Et je cherche à actualiser la BD pour partir d'une base vide, mais en gardant mes presets et réglages. Merci pour votre aide. @ bientôt ! RE: purge_non_existing_images.sh - pascal - 08-05-19 > Et je cherche à actualiser la BD pour partir d'une base vide, mais en gardant mes presets et réglages. Normalement tu supprimes uniquement library.db et tu réimportes toutes tes images. Toujours faire une copie des BD avant on ne sait jamais. Maintenant il faudrait aussi comprendre ce que ne marche pas avec purge_non_existing_images.sh! Un message d'erreur... Que dis le script? RE: purge_non_existing_images.sh - PSIFWI - 08-05-19 Merci pour ta réponse le contenu du script : #!/bin/sh DRYRUN=yes if [ "$1" = "-p" ]; then DRYRUN=no fi DBFILE=~/.config/darktable/library.db TMPFILE=$(mktemp -t tmp.XXXXXXXXXX) QUERY="select A.id,B.folder,A.filename from images as A join film_rolls as B on A.film_id = B.id" sqlite3 $DBFILE "$QUERY" > "$TMPFILE" echo "Removing the following non existent file(s):" cat "$TMPFILE" | while read -r result do ID=$(echo "$result" | cut -f1 -d"|") FD=$(echo "$result" | cut -f2 -d"|") FL=$(echo "$result" | cut -f3 -d"|") if ! [ -f "$FD/$FL" ]; then echo " $FD/$FL with ID = $ID" if [ $DRYRUN = no ]; then for table in images meta_data; do sqlite3 "$DBFILE" "delete from $table where id=$ID" done for table in color_labels history mask selected_images tagged_images; do sqlite3 "$DBFILE" "delete from $table where imgid=$ID" done fi fi done rm "$TMPFILE" if [ $DRYRUN = no ]; then # delete now-empty filmrolls sqlite3 "$DBFILE" "DELETE FROM film_rolls WHERE (SELECT COUNT(A.id) FROM images AS A WHERE A.film_id=film_rolls.id)=0" else echo echo Remove following now-empty filmrolls: sqlite3 "$DBFILE" "SELECT folder FROM film_rolls WHERE (SELECT COUNT(A.id) FROM images AS A WHERE A.film_id=film_rolls.id)=0" fi if [ $DRYRUN = yes ]; then echo echo to really remove non existing images from the database call: echo "$0" -p fi Une fois lancé via le menu contextuel ==> rien ne se passe Lancé via le terminal : brice@brice-System-Product-Name:~/Images$ chmod +x purge_non_existing_images.sh patrice@patrice-System-Product-Name:~/Images$ ls -l total 2672 -rw-r--r-- 1 brice patrice 2725987 mai 1 15:31 'Capture d’écran du 2019-05-01 15-31-26.png' -rwxrwxr-x 1 brice patrice 1403 mai 8 10:13 'purge_non_existing_images (1).sh' -rwxrwxr-x 1 brice patrice 1403 mai 8 10:17 purge_non_existing_images.sh brice@brice-System-Product-Name:~/Images$ ./purge_non_existing_images.sh ./purge_non_existing_images.sh: 12: ./purge_non_existing_images.sh: sqlite3: not found Removing the following non existent file(s): Remove following now-empty filmrolls: ./purge_non_existing_images.sh: 45: ./purge_non_existing_images.sh: sqlite3: not found to really remove non existing images from the database call: ./purge_non_existing_images.sh -p brice@brice-System-Product-Name:~/Images$ purge_non_existing_images.sh - jpverrue - 08-05-19 As-tu bien utilisé l'option '-p' pour supprimer ? Car sinon, le script ne fait que lister. RE: purge_non_existing_images.sh - jpg54 - 08-05-19 Comme souvent demandé, @PSIFWI tu peux mettre le script dans une boîte "code". RE: purge_non_existing_images.sh - nicoauffray - 08-05-19 Et merci d'éditer ton message et d'intégrer le code du script avec la balise de code. Utilise l'option d'édition complète pour ça. La balise code est juste à droite des balises de numérotation. RE: purge_non_existing_images.sh - PSIFWI - 08-05-19 Ben Voilà le message en retour : :~/Images$ ./purge_non_existing_images.sh -p ./purge_non_existing_images.sh: 12: ./purge_non_existing_images.sh: sqlite3: not found Removing the following non existent file(s): ./purge_non_existing_images.sh: 41: ./purge_non_existing_images.sh: sqlite3: not found RE: purge_non_existing_images.sh - pascal - 08-05-19 du coup le message est clair... tu dois installer sqlite3 ![]() RE: purge_non_existing_images.sh - pascal - 08-05-19 J'ai ajouté des vérifications dans le script pour avoir un message plus explicite: https://github.com/darktable-org/darktable/commit/43af1a39ac527ec06961d7c05fa657dd95345d48 |