Bulk-downloading Shopify files

Shopify comes with a pretty good file storage solution, as documented on their help center, you can upload, manage, and delete files from the Files page in Shopify. All files uploaded to Shopify end up here, this means all product images, collections images and images uploaded via Theme/Section settings.

You can upload many files at once using the uploader, you can delete multiple files using the bulk actions toolbar but one very strange quirk is that you cannot bulk-download these files. This is a huge problem when migrating from one Shopify store to another, think moving from a development shop to the merchant's production shop.

I figured out a way to bulk-download these files, it involves scraping the client-side admin UI code via the browser development tools Javascript console then using a Node.js script to download the files to your local machine.

If you need to do this, start off by making sure you've got Node.js installed on your machine, download and run the installer from the Node.js website - opt for the version which they state "Recommended For Most Users".

Next, open a Terminal window, if you're not sure how to do that, see this tutorial.

Now, click this link to download the Shopify Bulk File Downloader, save it to your desktop and unzip it.

Open your Terminal window and run the command cd ~/Desktop/shopify-bulk-file-downloader-master, then run the command npm i.

Next up, click this link, select all the code and copy it to your clipboard, with that code copied head over to the Files page of your Shopify acccount, that looks like this:

https://shop.myshopify.com/admin/settings/files

With this page open, open the Chrome Developer Tools (View -> Developer -> Development Tools) then click the "Console" tab, paste the code copied to your clipboard in here and press the Enter key - eventually you'll see an alert which states "File URLS have been copied to your clipboard!".

Now head over to your Desktop directory in Finder and open the file file-urls.json, you can open this on any text-editing app (TextEdit, Notepad, etc.) and paste the results into this file, save and close it.

Go back to your Terminal window and run the command node server, a new directory will be created in the shopify-bulk-file-downloader-master directory called "files", all files will be downloaded there and you'll see a "Success!" message in the Terminal when finished.

Enjoy. :)