• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 26
  • Last Modified:

One Drive_Backup

I have and old backup of files I'm trying to sync to OneDrive, I get all errors on file name contains characters or path too long.

How can I bypass that policy as I have 400gb of files to upload.

of there is a different place for this kind of files on office 365
  • 4
  • 2
1 Solution
Vasil Michev (MVP)Commented:
You cannot bypass the policy. ODFB is not designed to be a replacement for file shares or used as a backup solution. You can certainly try to use them as such, but dont expect them to function the same.

That being said, Microsoft is constantly improving on the list of unsupported chars and should also be making some changes around the path length soon.
alonig1Author Commented:
What do I do with all of files that can't be upload.

She must be a solution.
Vasil Michev (MVP)Commented:
Rename them?
Free tool for managing users' photos in Office 365

Easily upload multiple users’ photos to Office 365. Manage them with an intuitive GUI and use handy built-in cropping and resizing options. Link photos with users based on Azure AD attributes. Free tool!

alonig1Author Commented:
Yes Vasil Michev,

I will rename millions of files.

Why didn't I think about it?
David Johnson, CD, MVPOwnerCommented:
one could always use powershell to find and fix but it would no longer be a 'backup'
    function Check-IllegalCharacters ($Path, [switch]$Fix, [switch]$Verbose)
     # http://get-spscripts.com/2011/11/use-powershell-to-check-for-illegal.html
        Write-Host Checking files in $Path, please wait...
        #Get all files and folders under the path specified
        $items = Get-ChildItem -Path $Path -Recurse
        foreach ($item in $items)
            #Check if the item is a file or a folder
            if ($item.PSIsContainer) { $type = "Folder" }
            else { $type = "File" }
            #Report item has been found if verbose mode is selected
            if ($Verbose) { Write-Host Found a $type called $item.FullName }
            #Check if item name is 128 characters or more in length
            if ($item.Name.Length -gt 127)
                Write-Host $type $item.Name is 128 characters or over and will need to be truncated -ForegroundColor Red
                #Got this from http://powershell.com/cs/blogs/tips/archive/2011/05/20/finding-multiple-regex-matches.aspx
                $illegalChars = '[&{}~#%]'
                filter Matches($illegalChars)
                    $item.Name | Select-String -AllMatches $illegalChars |
                    Select-Object -ExpandProperty Matches
                    Select-Object -ExpandProperty Values
                #Replace illegal characters with legal characters where found
                $newFileName = $item.Name
                Matches $illegalChars | ForEach-Object {
                    Write-Host $type $item.FullName has the illegal character $_.Value -ForegroundColor Red
                    #These characters may be used on the file system but not SharePoint
                    if ($_.Value -match "&") { $newFileName = ($newFileName -replace "&", "and") }
                    if ($_.Value -match "{") { $newFileName = ($newFileName -replace "{", "(") }
                    if ($_.Value -match "}") { $newFileName = ($newFileName -replace "}", ")") }
                    if ($_.Value -match "~") { $newFileName = ($newFileName -replace "~", "-") }
                    if ($_.Value -match "#") { $newFileName = ($newFileName -replace "#", "") }
                    if ($_.Value -match "%") { $newFileName = ($newFileName -replace "%", "") }
                #Check for start, end and double periods
                if ($newFileName.StartsWith(".")) { Write-Host $type $item.FullName starts with a period -ForegroundColor red }
                while ($newFileName.StartsWith(".")) { $newFileName = $newFileName.TrimStart(".") }
                if ($newFileName.EndsWith(".")) { Write-Host $type $item.FullName ends with a period -ForegroundColor Red }
                while ($newFileName.EndsWith("."))   { $newFileName = $newFileName.TrimEnd(".") }
                if ($newFileName.Contains("..")) { Write-Host $type $item.FullName contains double periods -ForegroundColor red }
                while ($newFileName.Contains(".."))  { $newFileName = $newFileName.Replace("..", ".") }
                #Fix file and folder names if found and the Fix switch is specified
                if (($newFileName -ne $item.Name) -and ($Fix))
                    Rename-Item $item.FullName -NewName ($newFileName)
                    Write-Host $type $item.Name has been changed to $newFileName -ForegroundColor Blue

Open in new window

alonig1Author Commented:
I found a 3rd party tool that did the work for me. thinkscape.com

I wish there was a free tool
alonig1Author Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now