Skip to content

About

Server-side OneDrive to SharePoint migration tool with parallel batch copies, session resume, and SP-aware file verification via Microsoft Graph API.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Bulk Mover

Copies files from a OneDrive source URL into a SharePoint document library using Microsoft Graph. The tool runs server-side copy jobs, so file bytes do not pass through your machine.

The current behavior is intentionally small:

  • Select a OneDrive root folder or shortcut, or paste a OneDrive URL.
  • Select a followed SharePoint site, or paste a SharePoint site URL.
  • Select a destination document library and folder.
  • Choose copy/update, copy/update without trash, or audit mode.
  • Scan source and destination with Graph delta and visible progress.
  • Write a visible plan for every source and destination-only file.
  • Show compact terminal progress for folder creation, trash moves, copy submission, and monitoring.
  • Run folder creation, copy jobs, and trash moves with a controlled local concurrency window.
  • Copy missing files.
  • Replace destination files when the source is newer.
  • Move destination-only files to a root TRASH folder in the destination, renamed with their item ID to avoid conflicts.
  • Write plain logs and a final CSV report.
  • Never modify source files or folders.

Audit mode only scans source and destination, then writes plan.csv and report.csv. It does not create folders, copy files, replace files, or move destination-only files to TRASH.

Copy/update without trash mode copies missing files. If the source is newer, it creates a new destination file named like Name__newer_from_source_2026-06-25T172249Z.ext. It does not overwrite files or move destination-only files to TRASH.

Setup

pip install -r requirements.txt

Create .env:

AZURE_CLIENT_ID=your-app-client-id
AZURE_TENANT_ID=your-tenant-id

The Azure app needs delegated Microsoft Graph permissions:

  • Files.ReadWrite.All
  • Sites.ReadWrite.All
  • User.Read

Run

python migrate.py

There are no CLI flags. The script prompts for everything it needs, including whether to run copy/update, copy/update without trash, or audit mode.

Resume

Each run writes:

migration-logs/<timestamp>_<source>/
  run.json
  plan.csv
  ledger.jsonl
  report.csv

plan.csv lists every planned action. ledger.jsonl is append-only. Each file gets rows such as SUBMITTED, COMPLETED, SKIPPED, or FAILED. If a run stops or fails, the next launch offers to resume it and monitors any submitted copy jobs before rebuilding the plan.

Architecture

File Responsibility
migrate.py Single interactive entrypoint
auth.py MSAL device code auth and token cache
graph.py Microsoft Graph requests, URL resolution, copy jobs
prompts.py Terminal prompts
sync.py Delta scan, plan, folder create, copy submit, monitor, trash, report
report.py Shared log directory helpers

Copy, folder, and trash concurrency is controlled by MAX_ACTIVE_JOBS in sync.py. Copy monitor polling is controlled by COPY_POLL_INTERVAL.

Copy Rules

For each source file:

Condition Action
Destination file missing Copy
Source modified time is newer Replace
Destination appears current Skip
Destination file missing from source Move to TRASH with conflict-safe rename

Folders are created as needed. Existing destination folders are reused.

In audit mode these same actions are reported only. Nothing is changed.

In copy/update without trash mode, destination-only files are reported in the plan but are not moved. Newer source files are copied with a __newer_from_source_... suffix instead of replacing the destination file.

About

Server-side OneDrive to SharePoint migration tool with parallel batch copies, session resume, and SP-aware file verification via Microsoft Graph API.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages