A PowerShell 7 script that finds your own Reddit comments older than a chosen age, optionally overwrites them first, and then deletes them — with rate-limit friendliness, resume support, and a paper trail (CSV report).
It’s basically spring cleaning for your comment history. It runs using a session-derived token from your logged-in Reddit session. 🧽✨
Auth note (important): Session-derived token reuse only. Why not OAuth? Reddit is axing OAuth API access for regular users, so this script sticks to the session tokens you already have.
- 🧩 A single-file PowerShell script:
Invoke-RedditCommentDeath.ps1 - 🔐 Auth: session-derived token reuse (default)
- 🔎 Scans your user comment listing (newest → oldest)
- ⏳ Processes comments older than
-DaysOld - ✍️🧼 Optionally overwrites comment text (default) before deleting
- 🧾 Produces:
- a resume checkpoint JSON
- an append-only processed-id log
- a CSV report of actions taken
- 💣 Not a Reddit “nuke everything” button.
- 📝 Not a post/submission deleter.
- 🙅 Not for other users’ content.
- 🧠 Not guaranteed to outsmart every archive, cache, screenshot, or quote-tweet from 2017.
- 🔑 Auth: session-derived token reuse (
-SessionAccessToken), single-user only - 🧑⚖️ Identity verification: verifies
/api/v1/mebefore doing anything destructive. - 🔁 Resume support: safe to stop/re-run; it won’t reprocess already handled comments.
- 🔄 Multi-pass until exhausted: reruns passes from newest → oldest until a pass finds no eligible comments (works around Reddit’s ~1k comment listing window); adjustable via
-MaxPasses. - 🐢 Rate-limit aware: randomized delays + batching cooldowns + defensive retry logic.
- 🧪 Dry runs: see what would happen without changing anything.
- 📊 CSV report output: so future-you can answer “what did I do?” without guessing.
- 🚫 Exclude subreddits: optionally skip specific subreddits using
-ExcludedSubredditsFile(one subreddit name per line).
- 🐉 PowerShell 7+ (the script declares
#requires -Version 7.0) - For auth: a session-derived access token from a logged-in Reddit session (passed securely via
-SessionAccessToken).
-
Obtain a session-derived token from your logged-in Reddit session (treat as highly sensitive; do not log it).
-
Run a dry run first (seriously):
./Invoke-RedditCommentDeath.ps1 `
-SessionAccessToken (Read-Host "Session token" -AsSecureString) `
-DaysOld 90 `
-DryRun- Run for real (default: overwrite + delete):
./Invoke-RedditCommentDeath.ps1 `
-SessionAccessToken (Read-Host "Session token" -AsSecureString) `
-DaysOld 90Create a text file (one subreddit per line):
# excluded-subreddits.txt
AskReddit
r/SomeSub
/r/AnotherSub/
Then run:
./Invoke-RedditCommentDeath.ps1 `
-SessionAccessToken (Read-Host "Session token" -AsSecureString) `
-DaysOld 90 `
-ExcludedSubredditsFile "./excluded-subreddits.txt"For full setup, refresh-token instructions, overwrite modes, rate-limit knobs, resume files, and troubleshooting:
- 👉 See UserGuide.md
(Yes, it’s longer. Yes, that’s on purpose. The alternative is you guessing at Reddit’s auth quirks by “vibes,” and nobody wants that.)
By default the script creates these files alongside where you run it:
./reddit_cleanup_state.json(resume checkpoint)./reddit_cleanup_state.processed_ids.log(append-only processed fullnames)./reddit_cleanup_report.csv(what happened)
If you enable two-pass overwrites (set -TwoPassProbability > 0), it will also create a stable salt file:
./reddit_cleanup_state.two_pass_salt.txt(used to keep two-pass selection consistent across runs)
Paths can be overridden via parameters.
- Reddit’s
/user/{name}/commentslisting exposes roughly the newest 1,000 comments. Multi-pass mode shrinks that window over time and stops when a pass finds zero eligible items (older-than-cutoff, not excluded, not already processed). Excluded or newer comments remain and can still occupy that window. - Optional
-RetryFailureskeeps failed deletes off the processed list so they’re retried on later passes (default behavior marks failures processed).
This script can delete a lot of your comment history very quickly.
- 🧪 Use
-DryRunfirst. - 🧯 Consider using
-SafetyHoursif you’re worried about “cutoff boundary” mistakes. - 🐢 Reddit rate limits and anti-abuse systems exist; the defaults are intentionally conservative.
The Unlicense (public domain). ✅
"No rules are broken. No alarms are triggered. Things simply… disappear."