The Grand OneDrive Path Too Long Hotel

Last Updated on April 24, 2024 by rudyooms

This blog will show some limitations when migrating your files to SharePoint/Teams and OneDrive. When you are unaware of these limitations, you could end up in a world of pain… and sync errors!

I will divide this blog into multiple parts:

  1. Introduction
  2. Can we fix it?
  3. OneDrive Shortcuts
  4. Long Path Tool

1. Introduction

In one of my older blogs, I explained why I love OneDrive.

But simply migrating your legacy file shares by simply selecting source and destination within the migration tool and starting the migration is not the best practice. Why, you might ask?

Here is a good example:

Your end-users may want to sync their team sites to OneDrive. Within teams, you can simply press the synchronize button to sync the team site to OneDrive.

But what will you do when your end users have a complex and deep folder structure? Besides the complex file structure, what will happen when you stumble upon files with too many characters?

As shown above, we will run into the: The data area passed to a system call is too small error when we want to open such files.

Besides explorer.exe erroring out, if somehow we manage to get a long file in OneDrive, OneDrive will not be able to sync the item. As shown below, OneDrive will tell us that it can’t sync this item because the path is too long

Your users cannot open files in the OneDrive client larger than 259 characters. A simple method to check for files larger than 258 characters would be running this command.

Cmd /c dir /s /b |? {$_.length -gt 258}

By default, Windows uses a path length limitation (MAX_PATH); you can’t create or open files larger than 259 characters.

2. Can we fix it?

Could we try changing the longpathsenabled registry key? However, changing it to 1 will not help!

We have seen an excellent example of why 1-on-1 migrating your on-premise folder structure to Teams/SharePoint will not work.

You must transform your old on-premise folder structure to a new Microsoft Teams structure. Try not to use the general channel but create new channels (or private channels, when not everyone needs file access to that particular folder/channel in the team).

Every folder that needs to be migrated has to be checked. You don’t want more than 300k files synced if you are attached to some good performance

But what should you do if you have already migrated your data to SharePoint without transforming it to a less deep folder structure?

3. Using Shortcuts

When you look at the file path, you will notice it also has the Company name. So, if you used a long company name, you must change it before you sync the team’s site to OneDrive. I guess changing the username to only one letter is not preferred.

A better new method is using shortcuts for your OneDrive and giving it a proper name. (you will need to stop syncing the team site in Onedrive first)

After you have stopped the sync, it’s best practice to kill/close the OneDrive Client app first and remove that folder (to be sure you don’t end up with 2 of the same folders from which one isn’t being updated anymore)

We have removed the old folder, started the OneDrive client, and browsed the SharePoint site from which you want to create a shortcut. Click on the icon as I am showing below to start creating the shortcut

After a minute or two, it all arrives in your OneDrive folder. You can rename the shortcut to give it a better name.

As you will see below, adding only a particular subfolder to OneDrive will resolve the issue instead of adding the whole team.

And that’s not the only benefit of using this option. When you use OneDrive on your mobile phone, you will notice the shortcut is also added to it. It is a very clear view, and you can make sure you can still access it even when you are offline. Isn’t that great?

But i am done yet, because even when using wonderful OneDrive shortcuts instead of syncing the whole folder structure, we need to take a look at a perfect tool that will help you to fix the long file names!

4. Long Path Tool

We use the Long Path Tool in every migration. With a few clicks, you can find out which files exceed the maximum of 255 characters. This tool can handle long-path files with more than 255 characters, offering fast scanning and the ability to copy multiple folders simultaneously.

Long Path Tool 5 – advanced long path files manager

This tool will save you a lot of time as it scans quickly and will come up with a good summary.

Conclusion:

If you want to move to a modern workplace and start collaborating, you must move and transform your data to SharePoint/Teams and OneDrive.

Before the migration, please be aware that there are many limitations. The maximum 260 characters in the OneDrive client is one of them. You don’t want to run away from the Limitations; accept them and deal with them!!

Please avoid using a long company name and run the long path tool!

10 thoughts on “The Grand OneDrive Path Too Long Hotel

  1. Thank you for sharing these tips. However, I have been using the Long Path Tool, it is super easy for migrating files.

    1. Hehehe… yep, we are indeed using the same tool .. (blog is a little bit becomming out dated it seems 🙂 )

    1. Finally some sane comments on the post and suggestions about tool are also welcomed. On my way to download LongPath Tool.

      1. The blog was a bit overdue.. 🙂 … needed to update it a bit… but yeah the long path tool is a lifesaves

Leave a Reply

Your email address will not be published. Required fields are marked *

  +  7  =  15