Undoing an import
Select on the source triple, never on "everything except what I wrote":
ruby -rjson -rfileutils -e '
n = 0
Dir.glob("content.nosync/posts/*/*.json").each do |f|
p = JSON.parse(File.read(f, encoding: "utf-8"))
s = p["source"] || {}
next unless s["platform"] == "PLATFORM" && s["account"] == "ACCOUNT"
d = File.join("media.nosync", File.basename(File.dirname(f)), p["slug"])
FileUtils.rm_rf(d) if Dir.exist?(d)
File.delete(f); n += 1
end
puts "removed #{n}"'
Fill in PLATFORM/ACCOUNT from any imported post's JSON, then rebuild and deploy with --prune --force (the guard will flag the shrink -- that's it working). The same selector is why re-importing later is safe.
