Skip to content

Instantly share code, notes, and snippets.

@th0rgall
Last active March 3, 2021 08:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save th0rgall/9a7ac0667cc28652f076fa71c6ae6421 to your computer and use it in GitHub Desktop.
Save th0rgall/9a7ac0667cc28652f076fa71c6ae6421 to your computer and use it in GitHub Desktop.
Download Shopify Admin Files given a comma-separated list text file
#!/bin/bash
# By @th0rgall - Feb. 1 2021
# Tool that loops over Shopify File URLs and downloads them with CURL
# Prerequisites:
# - In you PATH: curl > v7.22, sed
# - A file with shopify file names: use Jason Bowman's script at https://gist.github.com/freakdesign/a1636414cce682c2c444#file-get-all-files-from-shopify-admin-js
# to download a file list (more details on this: https://freakdesign.com.au/blogs/news/113610119-export-a-list-of-all-files-in-the-shopify-admin)
# Usage: ./shopifyfiles shopify-files-list.txt
# The script will make a directory 'files' and download files there
# read file list into a variable
filelist=$(cat "$1")
# make dir files
mkdir -p files
cd files
# loop over filelist split by comma
for i in ${filelist//,/ }
do
# download file with CURL, using the file name (& header file name if applicable, but it's probably not applicable)
curl -O -J "$i"
done
# remove the URL parameter parts
find ./ -type f -d 1 -name '*.*?*' -exec bash -c 'mv "$0" "$(echo "$0" | sed -E "s/\?.*$//")"' {} \;
cd ..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment