Skip to main content

How to mirror GDrive to local

· One min read

How to mirror data from GDrive to local

I tend to push larger repositories to GDrive as Github cannot easily host files above 100 MB. How would you mirror a GDrive folder and subfolders to your local drive and have an easy script to update these?

Below you find a Powershell script for Windows utilizing gdown!

Powershell script to download GDrive folder with gdown

Download GDrive with gdown
# Set Google Drive URL and local directory variables
$GoogleDriveUrl = "https://drive.google.com/drive/folders/YOUR_FOLDER_URL"
$LocalDirectory = "C:\Down\YOUR_TARGET_FOLDER"

# Install install pip
winget install pip

#install gdown
pip install gdown

# Get the list of files and folders in the Google Drive folder
$downloadCommand = "gdown $($GoogleDriveUrl) -O $($LocalDirectory) --folder"

Invoke-Expression $downloadCommand

# Add a pause at the end of the script
Write-Host "Press Enter to exit script" -ForegroundColor White
Read-Host