Delete files older than 30 days from your Slack team. Purges public and private files to free up space under the free team storage limit imposed by Slack.


Note: a file is provided - this is my own personal script, provided as an example. If you try to run it, there will likely be errors: I am using my own script to post logs to a Discord webhook. If you manage to successfully configure and run it, logs will be posted in ./logs/.

How to Use

  1. Set up DeleteFiles on your machine
    • $ git clone && cd slack-deletefiles
    • $ pipenv install
  2. Authorize DeleteFiles for your team (see below)
  3. $ python3 -m pipenv run python

Authorizing DeleteFiles for your Team

Note: you must have JavaScript enabled to fetch your OAuth token! Read more under #3 below.

  1. Authorize DeleteFiles with the required permissions for your Slack team. Click here to do so.
  2. You will be redirected to a site that will give you your token - save this token!
    • You must have JavaScript enabled to fetch the token. This is because the temporary one-time-use code is sent to my API, which fetches your token from Slack using deletefiles’ client ID and secret token.
  3. Copy your OAuth token to a file called .env inside the folder created by git clone during the install process

Required Permissions

  • files:read
    • Required to get a list of files from your Slack team
  • files:write:user
    • Required to delete public and private files