Thursday, June 18, 2026

How to Automatically Download, Organize, and Sync All Your Canvas Course Files to Google Drive (Without Losing Your Mind)

How to Automatically Download, Organise, and Sync All Your Canvas Course Files to Google Drive (Without Losing Your Mind)

Navigating Canvas is a deadweight time tax that students hate. When you are juggling intense coursework alongside professional commitments, wasting cognitive bandwidth hunting through nested web subfolders for a reading from three weeks ago is pure friction. You need your academic library offline, cleanly indexed, and instantly searchable.

Below is the blueprint for a localised file engine that completely automates this process. With a single terminal command, it queries Canvas, extracts your materials, converts cluttered presentation slides into clean PDFs, and streams organised folders straight to your secure cloud backup. Note that files locked behind library paywalls or external university login gates cannot be scraped directly, but the system automatically flags these in a custom checklist for quick manual download.

Setting up this pipeline requires no coding experience—just about 20 minutes of initial configuration and the ability to copy and paste text into a terminal window.


What This System Does For You

  • Smart Downloading: It checks Canvas for you, skipping files you already have and only downloading brand-new materials your professors just uploaded.
  • Non-Destructive Cloud Archiving: It copies new documents to your Google Drive without deleting old files. If you clear out local space on your hard drive, your cloud files remain safe.
  • The "To-Do" Checklist: If a professor links to an external website or a locked library archive requiring a separate web login, the script leaves a text file in your coursework folder (login_links.txt) telling you exactly what you need to fetch manually.
  • Automatic Formatting: It automatically finds every Word document and PowerPoint slide deck and creates a clean PDF version right next to it, leaving your originals completely untouched.
  • Human-Readable Folders: Canvas names folders using random code numbers. This system automatically reads your course names and cleans them up to match your actual subject titles (e.g., Accounting for Management).

Step 1: Set Up Your Computer's Free Toolkit

We need to install three free tools: Python (to talk to Canvas), LibreOffice (to handle the PDF conversions), and Rclone (to securely talk to Google Drive). Find your operating system below and copy-paste the commands into your terminal window.

🌐 For Chromebook (ChromeOS) & Modern Linux Users

Newer updates to Chromebooks use Debian Linux, which safely locks down Python environments to protect the system. We use an isolated app manager called pipx to bypass this barrier natively. Open your Terminal app, select Penguin, and paste this block:

sudo apt update
sudo apt install -y python3 python3-pip libreoffice rclone pipx
pipx install canvas-downloader
pipx ensurepath
source ~/.bashrc

🪟 For Windows Users

Windows handles file paths and Linux shell scripts poorly on its own, so we use the built-in Windows Subsystem for Linux (WSL) to run this smoothly.

  1. Open your Windows Start Menu, type PowerShell, right-click it, and choose Run as Administrator.
  2. Type this command and hit Enter: wsl --install
  3. Restart your computer.
  4. Open the newly installed Ubuntu terminal from your Windows Start menu. Follow the quick prompt to create a simple username and password.
  5. Inside that new terminal window, paste the setup commands:
sudo apt update
sudo apt install -y python3 python3-pip libreoffice rclone pipx
pipx install canvas-downloader
pipx ensurepath
source ~/.bashrc

🍏 For Mac Users

  1. Open your Terminal app. (If you don't have the Homebrew tool manager installed, get it first from brew.sh).
  2. Run this block to install the tools, utilising pipx to keep your environment pristine. Note that modern macOS configurations use Zsh by default, so we reload the shell path accordingly:
brew install rclone python pipx
pipx install canvas-downloader
pipx ensurepath
brew install --cask libreoffice
sudo ln -s /Applications/LibreOffice.app/Contents/MacOS/soffice /usr/local/bin/libreoffice
source ~/.zshrc

📱 For iOS Users (iPhone & iPad)

The Mobile Reading Strategy: Due to Apple's security rules, you cannot run background terminal scripts directly on an iPhone or iPad.

Instead, run this automation script on your computer or Chromebook. Because the engine automatically pushes your beautifully organised PDFs straight into your Google Drive, your iOS device becomes the ultimate viewing destination. Simply install the free Google Drive app from the App store, and your entire current course library will be sitting right there, offline-ready and perfectly indexed.

Step 2: Link Your Google Drive Securely

We will use Rclone to talk to your Google account. It uses Google's official, secure validation process. It will never see or save your password.

  1. In your terminal window, type this command and hit Enter:
    rclone config
  2. Type n and hit Enter to create a new connection.
  3. Type a distinct name for your remote profile (for example: MBS_Google or gdrive) and hit Enter. CRITICAL NOTE: Remember exactly what you type here; you will need this exact label in Step 4.
  4. You will see a long list of cloud storage types. Find Google Drive in the list, type drive and hit Enter.
  5. Leave the client_id and client_secret prompts completely blank by hitting Enter twice.
  6. Choose the option corresponding to full drive access (usually option 1).
  7. Hit Enter at the next two prompts to accept the blank defaults.
  8. When it asks Use auto-config?, type y. Your web browser will automatically open. Log into your university or personal Google account, click Allow, and close the tab when it says "Success!".
  9. Type n when asked if it is a Shared Drive, confirm everything with y, and finally type q to quit the setup wizard.

Step 3: Get Your Secret Canvas Key

To download your files, the script needs a temporary digital key from your Canvas account.

  1. Log into your university Canvas website using a web browser.
  2. Click on Account (your profile picture) in the top left corner, then click Settings.
  3. Scroll down to the section that says Approved Integrations and click the button that says + New Access Token.
  4. Type a purpose (like "File Sync App") and click Generate Token.
  5. Copy the long string of letters and numbers that appears.
⚠️ Keep this key completely private. It is a temporary password to your student dashboard. Never share it or post it online.

Step 4: Create Your Secret Passcode File

We are going to create a hidden settings file on your computer. This keeps your private keys completely safe and separated from the main software script.

  1. Open a terminal window and type:
    nano ~/.canvas_sync.conf
  2. Paste the text below into the editor. Replace the placeholder values inside the quotation marks with your actual web address, your secret Canvas token, and the path where you want things saved on Google Drive. Make sure to replace YOUR_REMOTE_NAME with the exact label you created in Step 2:
# Secure Canvas Configuration File
TOKEN="PASTE_YOUR_LONG_CANVAS_TOKEN_HERE"
CANVAS_URL="https://youruniversity.instructure.com"
GDRIVE_PATH="YOUR_REMOTE_NAME:your_nested_folder_path/Uni"
  1. Save and close the file by pressing Ctrl + O, hitting Enter, and then pressing Ctrl + X.
  2. Lock down the security of this file so other apps cannot view it:
    chmod 600 ~/.canvas_sync.conf

Step 5: Deploy the Main Sync Script

This is the main automated engine. It reads your configuration file, hooks up with Canvas, cleans up messy folder names, runs the PDF conversions, logs errors, and handles the Google Drive upload entirely on its own.

This is the only long step; you do not need to understand every line of code to use it.

  1. Create your main coursework folder and open it:
    mkdir -p ~/Downloads/Coursework && cd ~/Downloads/Coursework
  2. Create the script file:
    nano canvas_sync.sh
  3. Paste the complete, automated script below directly inside the file:
#!/bin/bash

# Ensure script executes out of the current directory context
cd "$(dirname "$0")" || exit 1

# Establish a baseline execution timestamp for the summary report
touch .sync_start

# =====================================================================
# SOURCE CONFIGURATIONS
# =====================================================================
CONFIG_FILE="$HOME/.canvas_sync.conf"
if [ -f "$CONFIG_FILE" ]; then
    . "$CONFIG_FILE"
else
    echo "[!] CRITICAL ERROR: Configuration file not found at $CONFIG_FILE"
    echo "    Please create it with secure permissions before running this script."
    exit 1
fi

# Dynamically locate the downloader binary across different OS configurations
if command -v canvas-downloader &> /dev/null; then
    DOWNLOADER_BIN=$(command -v canvas-downloader)
else
    DOWNLOADER_BIN="$HOME/.local/bin/canvas-downloader"
fi

CHECKLIST_FILE="login_links.txt"
RAW_LOG=".raw_sync_log.txt"
CONVERSION_ERRORS="conversion_failures.txt"

# Clear historical execution artifacts
rm -f "$RAW_LOG" "$CHECKLIST_FILE" "$CONVERSION_ERRORS"

echo "========================================="
echo " STEP 0: Verifying Canvas API Access"
echo "========================================="
if ! python3 -c "import requests; r=requests.get('$CANVAS_URL/api/v1/users/self', headers={'Authorization': 'Bearer $TOKEN'}); assert r.status_code == 200" 2>/dev/null; then
    echo "[!] ERROR: Canvas API token is invalid, expired, or URL is unreachable."
    echo "    Please verify credentials in $CONFIG_FILE."
    exit 1
fi
echo "[+] API token authentication verified."

echo "========================================="
echo " STEP 1-3: Streaming Live Course Data Sync"
echo "========================================="
SYNC_ERROR=0

# PROCESS SUBSTITUTION: Using < <(python3 ...) keeps execution in the parent shell
# so that trackable metrics and variables persist correctly outside the block.
while IFS=":::" read -r course_id course_name; do
    
    [ -z "$course_id" ] && continue
    
    # SANITIZATION: Clean structural layout characters out of filesystem paths
    clean_name=$(echo "$course_name" | tr -d '[:cntrl:]' | sed 's/[/\\*?:"<>|]/_/g' | sed 's/[[:space:]]*$//')
    
    echo "-> Processing: $clean_name ($course_id)"
    
    # 1. Automated Course Incremental Download Sync
    "$DOWNLOADER_BIN" --canvas-url "$CANVAS_URL" --api-token "$TOKEN" --output-dir "." --include-assignments --course-id "$course_id" 2>&1 | tee -a "$RAW_LOG"
    
    # 2. Dynamic Desktop Link Mapping
    if [ -d "$course_id" ]; then
        ln -sfn "$course_id" "$clean_name"
    fi
    
    # 3. Secure Accumulative Cloud Sync (Non-destructive copy configuration)
    if [ -d "$course_id" ]; then
        rclone copy "$course_id" "$GDRIVE_PATH/$clean_name" --exclude ".*" --quiet
        if [ $? -ne 0 ]; then
            echo "    [!] Cloud sync warning encountered on: $clean_name"
            SYNC_ERROR=1
        fi
    fi
    
    sleep 2

done < <(python3 -c "
import requests
try:
    r = requests.get('$CANVAS_URL/api/v1/courses?per_page=100', headers={'Authorization': 'Bearer $TOKEN'}).json()
    for c in r:
        if isinstance(c, dict) and 'id' in c and 'name' in c:
            print(f\"{c['id']}:::{c['name']}\")
except Exception:
    pass
")

echo "========================================="
echo " STEP 4: Running Smart PDF Conversion"
echo "========================================="
find . -type f \( -name "*.docx" -o -name "*.pptx" -o -name "*.doc" -o -name "*.ppt" \) -print0 | while IFS= read -r -d '' file; do
    pdf_file="${file%.*}.pdf"
    
    if [ -f "$pdf_file" ]; then
        continue
    else
        echo "Converting new document: $file"
        
        # 30s timeout protection cap, isolated profile contexts, and blocked stdin hijacking
        timeout 30s libreoffice "-env:UserInstallation=file:///tmp/lo_convert_$$" --headless --convert-to pdf --outdir "$(dirname "$file")" "$file" < /dev/null
        
        if [ $? -eq 124 ]; then
            echo " [!] WARNING: Conversion timed out on $file (likely corrupt). Skipping."
            echo "$file" >> "$CONVERSION_ERRORS"
            rm -f "$(dirname "$file")/.~lock.$(basename "$file")#" 2>/dev/null
        fi
    fi
done
rm -rf /tmp/lo_convert_* 2>/dev/null

echo "========================================="
echo " STEP 5 AUDIT: Building Login Checklist"
echo "========================================="
if [ -f "$RAW_LOG" ]; then
    grep -E "Failed|403|401|Forbidden|Unauthorized" "$RAW_LOG" > "$CHECKLIST_FILE"
fi

if [ -s "$CHECKLIST_FILE" ]; then
    echo "[!] Attention needed: External or locked links flagged."
    echo "    Check '$(pwd)/$CHECKLIST_FILE' for items requiring manual browser actions."
else
    rm -f "$CHECKLIST_FILE" 2>/dev/null
fi

echo "========================================="
echo " SUMMARY REPORT"
echo "========================================="
NEW_FILES=0
if [ -f "$RAW_LOG" ]; then
    NEW_FILES=$(grep -cE "Downloaded:|██████████" "$RAW_LOG" 2>/dev/null || echo "0")
fi
MANUAL_LINKS=0
if [ -f "$CHECKLIST_FILE" ]; then
    MANUAL_LINKS=$(wc -l < "$CHECKLIST_FILE" 2>/dev/null || echo "0")
fi
PDF_COUNT=$(find . -name "*.pdf" -newer .sync_start 2>/dev/null | wc -l || echo "0")
FAILED_CONVERSIONS=0
if [ -f "$CONVERSION_ERRORS" ]; then
    FAILED_CONVERSIONS=$(wc -l < "$CONVERSION_ERRORS" 2>/dev/null || echo "0")
fi

echo " New files downloaded from Canvas : $NEW_FILES"
echo " Office documents built to PDF   : $PDF_COUNT"
echo " Failed document PDF conversions : $FAILED_CONVERSIONS"
echo " Flagged items requiring login   : $MANUAL_LINKS"
echo "-----------------------------------------"

if [ "$SYNC_ERROR" -eq 0 ]; then
    echo "[+] SUCCESS: Cloud infrastructure mirrors are completely current."
else
    echo "[!] WARNING: Cloud sync finished with localized folder exceptions."
fi

# Clear state files
rm -f .sync_start "$RAW_LOG"
echo "========================================="
echo " WORKFLOW COMPLETE"
echo "========================================="
  1. Save and close the editor (Ctrl+O, Enter, Ctrl+X).
  2. Give your computer official permission to run the script file:
    chmod +x canvas_sync.sh

Step 6: Run the Engine

Whenever you want to completely update your course dashboard, download new readings, build PDFs, and back them up, simply run this command in your terminal window:

./canvas_sync.sh

What You Will See Next Week:

The script will turn on, verify your keys, look at Canvas, and instantly bypass the files you already have. It will pull down the brand-new files, quietly turn them into cloud-friendly PDFs, and sync them seamlessly to your organised Google Drive folder without you having to click a single button.


Troubleshooting & Core Constraints

While this pipeline is engineered defensively, users should keep a few operating constraints in mind:

  • University Security Restrictions: Canvas setups vary heavily by institution. A small number of universities restrict API access tokens or enforce strict single-sign-on (SSO) profile locks. If the tool connects successfully but returns zero files, verify your token permissions with your student dashboard helpdesk.
  • Course Limits: This pipeline processes up to 100 courses per run due to core Canvas API page limitations.
  • Complex Office Documents: Highly complex formulas, legacy layouts, or heavy password protections in old .doc or .ppt files can occasionally cause the background PDF processor to skip a file. If an asset isn't generating a PDF mirror, check the conversion_failures.txt log in your folder.
  • Cloud Authentication Reconnects: Google security tokens typically stay persistent. However, if your university updates its network authentication rules, you can quickly re-link your drive by entering rclone config reconnect YOUR_REMOTE_NAME in the terminal.

Friday, February 3, 2012

My apt sources.list

My /ect/apt/sources.list on Ubuntu 10.04.3 LTS (Lucid Lynx).

Code:
# MAIN
deb http://archive.ubuntu.com/ubuntu/ lucid main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ lucid main restricted universe multiverse

# UPDATES
deb http://archive.ubuntu.com/ubuntu/ lucid-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ lucid-updates main restricted universe multiverse

# BACKPORTS
deb http://archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse

# SECURITY
deb http://security.ubuntu.com/ubuntu lucid-security main restricted universe multiverse
deb-src http://security.ubuntu.com/ubuntu lucid-security main restricted universe multiverse

# CANONICAL
deb http://archive.canonical.com/ lucid partner
deb http://archive.canonical.com/ubuntu lucid partner
deb-src http://archive.canonical.com/ubuntu lucid partner

# TOR
deb http://deb.torproject.org/torproject.org lucid main
deb-src http://deb.torproject.org/torproject.org lucid main

# MEDIBUNTU ## wget --quiet http://packages.medibuntu.org/medibuntu-key.gpg -O - | sudo apt-key add -
deb http://packages.medibuntu.org/ lucid free non-free
deb-src http://packages.medibuntu.org/ lucid free non-free

# GOOGLE ## wget --quiet http://dl.google.com/linux/linux_signing_key.pub -O - | sudo apt-key add -
deb http://dl.google.com/linux/deb/ stable non-free
Use at your own risk, no responsibility taken, this might break your machine, etcetera, etcetera.

Copy a website using wget

Download a copy of a whole website using wget

Code:
wget --random-wait --limit-rate=20K -r -p -e robots=off -U mozilla http://www.targetsite.com
Use at your own risk, no responsibility taken, this might break your machine &/or get you into trouble & it will probably upset the targetsite you are downloading, etcetera, etcetera.

Fix a broken gnome panel

A simple, one line command to fix a broken gnome panel & restore it to the default settings. I came across it after I accidentally deleted my Gnome panel. Lately I have found it useful for situations where the panel just becomes corrupt (I am always switching monitors) or the panel just won't do what you want it to do (hidden sound, network, time applets etc). Tested on Ubuntu 10.04.3 LTS (Lucid Lynx).

Code:
gconftool-2 -shutdown && gconftool --recursive-unset /apps/panel && rm -rf ~/.gconf/apps/panel && pkill gnome-panel
Use at your own risk, no responsibility taken, this might break your machine, etcetera, etcetera.

Purge unused Ubuntu linux kernels

A simple, one line command to delete (purge) old, unused Ubuntu linux kernels, & update your grub start-up menu. Tested on Ubuntu 10.04.3 LTS (Lucid Lynx).

Code:
sudo dpkg -l linux-* | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e [0-9] | xargs sudo apt-get -y purge
Use at your own risk, no responsibility taken, this might break your machine, etcetera, etcetera.

Saturday, May 15, 2010

HOWTO: delete your Facebook account

Ever tried to delete your Facebook account. They don't make it easy.

Most people look for a delete option on the Account Settings page. Ah, but that would be too obvious & they only give you the option to deactivate your profile. It puts your account on hold.... just in case you want to come back.

If you really want to delete your account, log in to your Facebook profile first and then click this link. It should take you straight to the well hidden Facebook “Delete my account” form.

Friday, May 14, 2010

Ubuntu 10.4 & your Epson C1100

Well 10.4 is finally out & running in the main stream, its quick, its slick & the windows now are all left hand drive (the maximise, minimise & close have all move left AKA mac style).

For me everything just works, it's rock solid & though I miss the old brown Ubuntu theme, I could never go back purple is this years black.

I had the same old issue with getting my Epson C1100 working but by following the simple steps below I was printing in less than 5 minutes.

10.4 like its predecessor seems to be missing libstdc++5_3.3.6-17ubuntu1_i386.deb

In order to install the Epson C1100 under 10.4 on the standard i386 platform please open an terminal via ACCESSORIES > TERMINAL & make a directory as explained below to store your installation files;


Code:
mkdir epson_install
move to the installation directory you just created;

Code:
cd epson_install
get the installation files from our website 000it.com

extract the compressed file;

Code:
tar -zxvf epson_c1100_install.tar.gz
install the deb installation files you have just extracted;

Code:
sudo dpkg -i *.deb
from here you can install your Epson C1100 just as you would normally install any other printer using the SYSTEM > ADMINISTRATION > PRINTERS menu. When/if called for the ppd (PostScript® printer description) file, please point to the "epson_install" directory & select the file Epson-AL-C1100-fm3.ppd