Last active
August 1, 2025 16:44
-
-
Save greird/94dbea010540022dca6010d9fd74d9d4 to your computer and use it in GitHub Desktop.
Revisions
-
greird revised this gist
Feb 20, 2023 . No changes.There are no files selected for viewing
-
greird revised this gist
Nov 16, 2022 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ #!/bin/bash # # This script will browse a Slack export folder and download all files in a new /export folder # # HOW TO: -
greird revised this gist
Nov 16, 2022 . 1 changed file with 18 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,24 @@ # This script will browse a Slack export folder and download all files in a new /export folder # # HOW TO: # 1. As a Workspace admin, download an export of your Slack history (https://www.slack.com/services/export) # 2. Make sure you have jq installed (https://stedolan.github.io/jq/) # 3. Place this file at the root of your Slack export folder, next to channels.json # 4. Run `bash slack-files-downloader.sh` in your terminal # # OPTIONS # -o Overwrite files if they already exist in destination folder, otherwise skip them. # -s Do not show message when a file is skipped while getopts "os" flag do case $flag in o) overwrite=true;; s) silent=true;; esac done printf "\nSelect one specific file type to download or leave empty for any (e.g. mp3, binary, jpg, png):\n" read usertype @@ -34,9 +47,12 @@ do if [[ ! -z $filename_raw ]] && [[ $filename_raw != "null" ]] then if [ -f "export/$channel/$filename" ] && [[ $overwrite != true ]] then if [[ $silent != true ]] then printf "$filename already exists in destination folder. Skipping!\n" fi continue fi -
greird revised this gist
Nov 16, 2022 . No changes.There are no files selected for viewing
-
greird revised this gist
Nov 16, 2022 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,6 +5,7 @@ # 3. Place this file at the root of your Slack export folder, next to channels.json # 4. Run `bash slack-files-downloader.sh` in your terminal printf "\nSelect one specific file type to download or leave empty for any (e.g. mp3, binary, jpg, png):\n" read usertype @@ -28,7 +29,7 @@ do filename_raw=$(echo $a | jq -r '.[0]') filename=$(echo $filename_raw | sed -e 'y/āáǎàçēéěèīíǐìōóǒòūúǔùǖǘǚǜüĀÁǍÀĒÉĚÈĪÍǏÌŌÓǑÒŪÚǓÙǕǗǙǛÜ/aaaaceeeeiiiioooouuuuuuuuuAAAAEEEEIIIIOOOOUUUUUUUUU/') filename="${filename##*/}" if [[ ! -z $filename_raw ]] && [[ $filename_raw != "null" ]] then -
greird revised this gist
Nov 16, 2022 . 2 changed files with 54 additions and 43 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,43 +0,0 @@ This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,54 @@ # This script will browse a Slack export folder and download all files in a new /export folder # HOW TO: # 1. As a Workspace admin, download an export of your Slack history (https://www.slack.com/services/export) # 2. Make sure you have jq installed (https://stedolan.github.io/jq/) # 3. Place this file at the root of your Slack export folder, next to channels.json # 4. Run `bash slack-files-downloader.sh` in your terminal printf "\nSelect one specific file type to download or leave empty for any (e.g. mp3, binary, jpg, png):\n" read usertype printf "\nSelect a channel to look into or leave empty for all channels:\n" read userchannel for channel in $(cat channels.json | jq -rc '.[].name') do if [[ $channel == $userchannel ]] || [[ -z $userchannel ]] then printf "\n============================================\nLooking into #$channel...\n============================================\n" for file in "$channel"/*.json do for a in $(cat $file | jq -c '.[].files[0] | [.title, .url_private_download, .filetype] | del(..|nulls)' | sed 's/ //g') do filetype=$(echo $a | jq -r '.[2]') if [[ $filetype == $usertype ]] || [[ -z $usertype ]] || [[ -z $filetype ]] then filename_raw=$(echo $a | jq -r '.[0]') filename=$(echo $filename_raw | sed -e 'y/āáǎàçēéěèīíǐìōóǒòūúǔùǖǘǚǜüĀÁǍÀĒÉĚÈĪÍǏÌŌÓǑÒŪÚǓÙǕǗǙǛÜ/aaaaceeeeiiiioooouuuuuuuuuAAAAEEEEIIIIOOOOUUUUUUUUU/') filename=$(echo $filename | sed 's/ //g') if [[ ! -z $filename_raw ]] && [[ $filename_raw != "null" ]] then if [ -f "export/$channel/$filename" ] then printf "Skipping $filename. It already exists in destination folder.\n" continue fi printf "Downloading $filename...\n" mkdir -p export/$channel url=$(echo $a | jq -rc '.[1]') curl --progress-bar $url -o "export/$channel/$filename" fi fi done done fi done -
greird created this gist
Nov 15, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,43 @@ echo "What file type do you want to export ? (e.g. mp3, binary, mp4)" echo "Leave empty for any." read usertype echo "Channel to look into (leave empty for all):" read userchannel for channel in $(cat channels.json | jq -rc '.[].name') do if [[ $channel == $userchannel ]] || [[ -z $userchannel ]] then echo "" echo "============================================" echo "Looking into #$channel..." echo "============================================" for file in "$channel"/*.json do for a in $(cat $file | jq -c '.[].files[0] | [.title, .url_private_download, .filetype] | del(..|nulls)' | sed 's/ //g') do filetype=$(echo $a | jq -r '.[2]') if [[ $filetype == $usertype ]] || [[ -z $usertype ]] || [[ -z $filetype ]] then filename=$(echo $a | jq -r '.[0]') if [[ ! -z $filename ]] && [ ! -f "export/$channel/$filename" ] then echo "Downloading $filename..." mkdir -p export/$channel filename=$(echo $filename | sed -e 'y/āáǎàçēéěèīíǐìōóǒòūúǔùǖǘǚǜüĀÁǍÀĒÉĚÈĪÍǏÌŌÓǑÒŪÚǓÙǕǗǙǛÜ/aaaaceeeeiiiioooouuuuuuuuuAAAAEEEEIIIIOOOOUUUUUUUUU/') filename=$(echo $filename | sed 's/ //g') url=$(echo $a | jq -rc '.[1]') curl -s $url -o "export/$channel/$filename" fi fi done done fi done