Check for unsupported characters by Sharepoint/OneDrive and fix
When uploading multiple files and folders to OneDrive, you are more or less bound to run into problems with file names containing unsupported characters. This script will search the selected folder, and sub folders, for files and folders containing these characters.
Background:
When uploading multiple files and folders to OneDrive, you are more or less bound to run into problems with file names containing unsupported characters.
What it does:
This script will search the selected folder, and sub folders, for files and folders containing these characters and optionally fix the issue.
Usage:
Extract the attached file and open PowerShell as administrator.
Browse to the folder containg the extracted file and type the following command: Import-Module OneDrive-Check.ps1
Now, run the following command, replacing <path> with the path to the folder you want to search: OneDrive-Check -Folder <path>
This will list all files and folders, containg unsupported characters, in red.
To automatically fix the issues, add the -Fix switch to the first command. It should be: OneDrive-Check -Folder <path> -Fix
When run, all unsupported characters will be removed from the file or folder name. (& will be replaced by “and”)
Characters removed/replaced by default
The following characters will be removed/replaced, but this can easily be changed in the script.
! – Removed
& – Replaced by “and”
{ – Removed
} – Removed
~ – Removed
# – Removed
% – Removed
Thanks to Andreas Molin for the script