For free tier memberships, Slack has a limit of 5gb for file uploads, this program wipes out old files.
Installation
pip3 install slack-bulkdelete
will create a new command slack-bulkdelete
Configuration
Create a configuration file with the Slack API token for a personal account that has administrative privileges. (Bot accounts will not work.)
Acquire a WEB API token for the Group Manager account. https://api.slack.com/docs/oauth-test-tokens
The API token is of the form xoxp-nnnnnnnnnn-nnnnnnn-nnnnnnnnn-aaaaaa.
Put the token, in quotes, in $HOME/.slack_api_token or the configuration file you specify on the command line. This file is a json format file, but only has the one entry.
Use
Before letting it run for real, try using –dry-run to see what files will be deleted and saved.
usage: __init__.py [-h] [-C CONFIG_PATH] [-n] [-u USERS] [-a MAX_AGE]
[-s MIN_SIZE] [-p]
optional arguments:
-h, --help show this help message and exit
-C CONFIG_PATH, --config-path CONFIG_PATH
configuration info (default: ~/.slack_api_token)
-n, --dry-run just simulate the deletes
-u USERS, --user USERS
limit delete to user
-a MAX_AGE, --max-age MAX_AGE
maximum age in days (default: 30)
-s MIN_SIZE, --min-size MIN_SIZE
minimum size (in kb) of file to delete (default: 200)
-p, --pinned include pinned files (you don't want this!)
Notes
Python 3 has some issues with Unicode encoding if the LANG environment variable is not set properly before the interepreter executes code. Make sure that LANG is set to a utf-8 encoding such as C.utf-8 or EN_us.utf-8.
Release files for slack-bulkdelete 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| slack-bulkdelete-1.1.0.tar.gz | 17.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| slack_bulkdelete-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.4 kB
Release files / slack-bulkdelete-1.1.0.tar.gz
| Download URL | slack-bulkdelete-1.1.0.tar.gz |
|---|---|
| Size | 17.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8c3a7b5c70733df383816a257243db79f4b4b416a4b4dbda532900aa2d9fdc98
|
|
BLAKE2b-256 checksum How to use checksums |
c59ecee6db79f56ba4d399d4388b92a80c91befc6f80af3a1e57fbcfb86484ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / slack_bulkdelete-1.1.0-py3-none-any.whl
| Download URL | slack_bulkdelete-1.1.0-py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b3df623abdd19016ceba0c40834fbab2e5ac12d1cc5897f2f64c00f5e4cfeb4e
|
|
BLAKE2b-256 checksum How to use checksums |
32a7893549369ea0c9603c4a7e5af4248d1791d9d11ed54067ad78d5d7c76c12
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |