Forum Discussion
Azure File Sync issues and errors - files/folders not syncing
It has been awhile since I posted this, but I noticed that I never posted our resolution. Basically, the special characters were the entire root of the problem.
I had found an incredible PowerShell script that helped me find and rename the files. There are actually two that I used. One just files the files and folders with the special characters, the other one will actually rename the file changing the special character to its closest latin equivalent. However, sometimes it even runs into characters it cannot change, so I use the first script to find and manually fix (luckily only a handful so far).
To find the files with the special characters
gci -recurse . | where {$_.Name -match "[^\u0000-\u007F]"}
The following searches for the special characters and renames using a valid character: So far this has worked beautifully.
function Convert-ToLatinCharacters {
param([string]$inputString)
[Text.Encoding]::ASCII.GetString([Text.Encoding]::GetEncoding("Cyrillic").GetBytes($inputString))
}
$files = gci -recurse | where {$_.Name -match "[^\u0020-\u007F]"}
$files | ForEach-Object {
$newname = Convert-ToLatinCharacters $_.Name
$newname = $newname.replace('?','_')
if ($_.Name -ne $newname) {
$num=1
$nextname = $_.Fullname.replace($_.Name,$newname)
while(Test-Path -Path $nextname)
{
$next = ([io.fileinfo]$newname).basename + " ($num)" + ([io.fileinfo]$newname).Extension
$nextname = $_.Fullname.replace($_.Name,$next)
$num+=1
}
echo $nextname
ren $_.Fullname $nextname
}
}
This was found here: https://superuser.com/questions/636247/how-do-i-remove-non-ascii-characters-from-filenames
It took a few days, and things didn't show as correct immediately, or even in several days. But needless to say after a long weekend I looked at everything on a Tuesday I believe and everything was synced properly.