File Share to SharePoint Online: Find Invalid Names, Paths Over 400 Characters and \\server Links Before They Break the Migration
SharePoint Online blocks the characters " * : < > ? / \ | in names, leading and trailing spaces, names like CON, PRN, AUX, NUL, COM0-9, LPT0-9, .lock and desktop.ini, anything containing _vti_ or starting with ~$, and a folder named forms at a library root. The full decoded path can be up to 400 characters, and files up to 250 GB. Scan the share for these before migrating, rename with a WhatIf pass first, then repoint \\server links inside documents to the new SharePoint URLs.
Published:
Last updated: 2026-10-29
What SharePoint Online actually rejects
| Rule | Limit | Usually comes from |
|---|---|---|
Characters " * : < > ? / \ | | Not allowed in file or folder names | Mac and Linux clients, NAS shares. NTFS blocks these, so a Windows share rarely has them. |
| Leading or trailing spaces | Not allowed | Copies from Macs, scripted exports, user typos |
| Reserved names | CON, PRN, AUX, NUL, COM0-COM9, LPT0-LPT9, .lock, desktop.ini | Old DOS-era apps, Windows folder settings |
| Name patterns | Containing _vti_, or starting with ~$ | FrontPage leftovers, Office owner/lock files |
Folder named forms | Not allowed at the root of a library | Share folders called Forms |
| Full path | 400 characters, decoded, including the file name | Deep project trees, plus the site and library URL you add in front |
| File size | 250 GB | Backups, VM images, video |
# and % are allowed now. If a migration guide tells you to strip them, it's out of date; but check older apps that build URLs from file names by hand.
Two limits sit below SharePoint's. OneDrive sync puts the files under a local folder such as C:\Users\name\Contoso\Site - Documents\, and Office desktop apps can fail to open files whose local path is longer than about 260 characters. If people will sync the library, aim well under 400.
Option 1: Microsoft's free migration tools
Migration Manager (SharePoint admin center, Migration) and the SharePoint Migration Tool (SPMT) both move file shares into SharePoint for free. Both scan the source first and report items they can't move. Run the scan before the real migration and fix what it finds, because a migration that fails on 4,000 names leaves people with half a library.
- Plan the target structure first. One share with 15 top-level folders usually becomes 15 libraries or sites, not one library with 15 folders. Every level you drop makes paths shorter.
- Decide on permissions. NTFS permissions don't map cleanly to SharePoint. Most teams set access on the site and libraries instead of carrying every folder ACL across.
- Exclude junk.
~$owner files,Thumbs.db,desktop.iniand.tmpfiles don't need to move. - Run big batches outside business hours. Migrations count against the same limits as everything else; see SharePoint throttling.
Option 2: Pre-scan and rename with PowerShell
Scan the share
This lists every name SharePoint will reject, and every path that will be too long once the site and library URL are added in front. It only reads. Run it in PowerShell 7, which handles long paths on Windows.
$Source = "\\fileserver01\Projects"
$TargetPath = "/sites/architecture-knowledge-base/Shared Documents/Projects" # decoded, after the host name
$MaxPath = 400
$invalidChars = '["*:<>?/\\|]'
$blockedName = '^(CON|PRN|AUX|NUL|COM\d|LPT\d)(\..*)?$|^\.lock$|^desktop\.ini$|_vti_|^~\