Skip to content

Instantly share code, notes, and snippets.

@ozh
Last active March 8, 2026 16:09
Show Gist options
  • Select an option

  • Save ozh/4968d6054b5ca83ec0e2d385c7edc51e to your computer and use it in GitHub Desktop.

Select an option

Save ozh/4968d6054b5ca83ec0e2d385c7edc51e to your computer and use it in GitHub Desktop.
Remove read books on kobo reader from the command line

Shell in the kobo, from the root :

sqlite3 -header .kobo/KoboReader.sqlite "SELECT ContentID FROM content WHERE BookTitle is null and ReadStatus = 2 ORDER BY Title;" | grep epub | sed 's!file:///mnt/onboard/!!' | while read f; do rm -f "$f"; done

@ozh
Copy link
Author

ozh commented Jul 12, 2022

To list before removal :

sqlite3 -header .kobo/KoboReader.sqlite "SELECT ContentID FROM content WHERE BookTitle is null and ReadStatus = 2 ORDER BY Title;" | grep epub | sed 's!file:///mnt/onboard/!!' | while read f; do echo "-> $f"; done

@ozh
Copy link
Author

ozh commented Aug 24, 2025

Using an online SQLite viewer like https://inloop.github.io/sqlite-viewer/ : list all read books

SELECT 
    Title,
    Attribution as Auteur,
    DateLastRead as DateTermine,
    ___PercentRead as PourcentageLu
FROM content 
WHERE ContentType = '6' 
    AND ReadStatus = 2  -- Terminé
    AND Title IS NOT NULL
    AND Title != ''
ORDER BY DateLastRead DESC;

@ozh
Copy link
Author

ozh commented Feb 15, 2026

Limit to a specific year :

SELECT 
    Title,
    Attribution as Auteur,
    DateLastRead as DateTermine,
    ___PercentRead as PourcentageLu
FROM content 
WHERE ContentType = '6' 
    AND ReadStatus = 2  -- Terminé
    AND Title IS NOT NULL
    AND Title != ''
    AND strftime('%Y', DateLastRead) = '2025'  -- Filtre sur l'année 2025
ORDER BY DateLastRead DESC;

To get them numbered in order of reading :

SELECT
    (SELECT COUNT(*)
     FROM content c2
     WHERE c2.ContentType = '6'
       AND c2.ReadStatus = 2
       AND c2.Title IS NOT NULL
       AND c2.Title != ''
       AND strftime('%Y', c2.DateLastRead) = '2025'
       AND c2.DateLastRead <= c1.DateLastRead) as Numero,
    c1.Title,
    c1.Attribution as Auteur,
    c1.DateLastRead as DateTermine,
    c1.___PercentRead as PourcentageLu
FROM content c1
WHERE c1.ContentType = '6'
    AND c1.ReadStatus = 2
    AND c1.Title IS NOT NULL
    AND c1.Title != ''
    AND strftime('%Y', c1.DateLastRead) = '2025'
ORDER BY c1.DateLastRead ASC;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment