Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
drops all messages older than some date from a textsecure backup
(def cutoff
(clj-time.coerce/to-long
(clj-time.core/date-time 2015 4 3 5 54)))
(with-open [input (java.io.FileInputStream.
"/Users/michael.blume/TextSecurePlaintextBackup.xml")
output (java.io.FileWriter.
"/Users/michael.blume/betterbackup.xml")]
(-> input
clojure.data.xml/parse
(update-in [:content] (fn [messages]
(filter #(-> % :attrs :date Long/parseLong (> cutoff)) messages)))
(clojure.data.xml/emit output)
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.