🛠️ Reddit Old Comments Cleanup Script

📌 Overview

This Python script automates the process of deleting old Reddit comments from your account. It uses the PRAW (Python Reddit API Wrapper) library to authenticate and fetch your comments, removing those older than a specified number of days.

🚀 Features

Automated Deletion - Deletes comments older than N days.
Rate-Limiting Prevention - Uses delays to comply with Reddit API limits.
Error Handling & Logging - Provides detailed logs for monitoring execution.


🔧 Setup & Installation

1️⃣ Prerequisites

Ensure you have:

  • Python >=3.7
  • praw installed (pip install praw)
  • A Reddit API client ID & secret (Register at Reddit Apps)

2️⃣ Clone the Repository

git clone https://github.com/mahenkpatel/reddit-comment-cleanup.git
cd reddit-comment-cleanup

3️⃣ Install Dependencies

pip install -r requirements.txt

4️⃣ Configure config.ini

Create a config.ini file in the script directory and add:

[Reddit]
client_id = YOUR_CLIENT_ID
client_secret = YOUR_CLIENT_SECRET
refresh_token = YOUR_REFRESH_TOKEN  # No password needed!
user_agent = YOUR_USER_AGENT

[Settings]
days_old = 30  # Number of days before comments are deleted

⚙️ Usage

python delete_comments.py

Logs are saved in reddit_cleanup.log, providing timestamps and deleted comment details.

📝 Logging & Error Handling

  • Logging: All deletions are logged in reddit_cleanup.log for reference.

  • Error Handling: Ensures unexpected failures do not stop execution.