r/sharepoint • u/Scouter_Ted • 4d ago
SharePoint Online SPO file path maximums
We are moving data from shared network drives to SPO, and the subject of what the exact maximum file path can be has come up.
When we were using Sharegate to do test migrations we got lots of errors saying that data couldn't be migrated due to maximum file path being exceeded.
When we ran a PS script to give us the path lengths, we can find LOTS of files with paths of 340+ characters, some 370 chars. That is also not counting the spaces as 3 chars.
The key is that this data will be sync'd to Onedrive, which as I understand it somehow adds the local path name on top of the URL. What I haven't been able to nail down is how much of that is added. For example if I look in Explorer right now, my Onedrive says "C:\users\username\Way Too Long of a Company Name Corporation". Paraphrasing of course, but in reality it's 65 characters long. Some people with longer user names will have an even longer path.
I assume we are going to be (trying to) forcing this department to rename folders and/or files to be shorter names, (please no more sentences), but I need to come up with a number that I can give for the maximum that will be allowed in the path/file name.
What do you think is the maximum path length I should say?
Some of this data may wind up in Teams sites. Does anyone know if that works differently?
Also this isn't even getting into all of the invalid characters that are in these folder/file names. That's a different can of worms.
P.S. Please save any rants about using onedrive to sync this data to laptops. Neither you or I are going to change the company's culture, so don't bother trying.
5
u/whatdoido8383 3d ago edited 3d ago
First off, highly recommend you reevaluate this. If your workflow requires access through Fie Explorer, SharePoint may not be the product for you. It's riddled with issues and is a constant ticket generator for us. We highly discourage it but of course, management pushed everything into SharePoint against our guidance and it's a constant mess.
File paths for Windows must be under 254 characters total for the whole path.
What really sucks is if you exceed that, OneDrive bombs out and shuts down until you fix it. Horrible user experience as now none of their data is in sync with the cloud.
4
u/dr4kun IT Pro 3d ago
Tell them 210-220. It's under 254 characters in total but this needs to include the whole path, from https, to work fine across all scenarios.
This is a data governance issue. Suggest they create more flat structures, with more top-level folders and not go into many levels of nestes folders. Create more sites tied into hubs and more libraries in those sites, tie navigation from home page and navigation tab. Create libraries with short names and no spaces, then rename them - the original name is used for the url. Keep short but self-explanatory urls for sites. Cut down on characters where possible but ultimately the very long folder and files names & multi-nested folders need to go.
Remember that access control should happen at site level, with extra restrictions at libraries if needed, but not at file/folder/subfolder level. Plan security and audiences first, then build a structure that supports that.
3
u/ShareGate_Shaylyn 3d ago
Hey, I work at ShareGate so I can help here.
SharePoint Online's URL limit is 400 characters, which is what our migration errors are flagging. The local OneDrive sync limit is 256 characters for the full local path including the C:\users\username\OneDrive prefix.
For your situation, with a 65 character OneDrive prefix and files at 340-370 characters, you're going to hit the local sync limit even on files that migrate successfully to SharePoint. The safe working maximum to give your department for the SharePoint path is probably around 180-190 characters, which leaves a buffer for the local path.
Our source analysis will flag everything approaching or exceeding the 400 character SharePoint limit. For the flatten folder hierarchy option in the tool, that can help reduce path depth if some of your deep folder structures are the main culprit rather than long file names. And for invalid characters, ShareGate can automatically replace those during migration so that should be covered.