Open briangig opened 8 years ago
What about date+time for the --before parameter? or even a --after too
If anyone ever wants to do this, run the slack-cleaner commant in a PowerShell script:
$Week = (get-date (Get-Date).AddDays(-5) -Format "yyyyMMdd")
Where -5 is the number of days back you want to clean up.
then
--before $Week
bash script for those that care.. just change variable for your name/token/how many days.
delete attachments, delete direct messages to a specific user, delete messages to a specific channel
#!/bin/bash
DAYS=12
USER=slack-username
TOKEN=xoxp-insert-your-token
RATE=1
dated=`date -j -v-${DAYS}d +%Y%m%d`
printf "\nRemoving files older than $DAYS days ($dated)\n"
slack-cleaner --rate $RATE --token $TOKEN --file --user $USER --perform --before $dated
printf "\nRemoving messages older than $DAYS days to Chase\n"
slack-cleaner --rate $RATE --token $TOKEN --message --direct chase --user $USER --perform --before $dated
printf "\nRemoving messages older than $DAYS days to #random\n"
slack-cleaner --rate $RATE --token $TOKEN --message --channel random --user $USER --perform --before $dated
I'm sure there is a way to do this with a variable...but I am too dumb. Would be a great feature to have built in!
Example: Delete messages older than one week, 3 days etc.