A utility to remove files older than 7 days from a Slack instance
python prune-slack [instance_name]
Where instance_name is (optionally) the Slack instance URL slug to access, for example python prune-slack acme-coders
would remove your aged files from the instance at acme-coders.slack.com
The script expects a Slack Legacy API token to be held in an environment variable SLACK_TOKEN
.
The script will output a message with the filename and ID of every file it tries to delete and the response JSON of the deletion attempt, for example:
Deleting file image.png... FEF6BTUKZ
{u'ok': True}
Deleting file example PN.jpg... FEFCFT3GD
{u'ok': True}
DONE!