Skip to content

Export OneDrive File Names for Review in CSV

Export OneDrive File Names for Review in CSV

This task is useful before migrations or application integrations that may have problems with file names, Unicode characters or long paths. Do not rename files automatically until the business owner has reviewed the report.

Local synced OneDrive example

If the OneDrive library is synchronised to a Windows computer, PowerShell can create a simple inventory:

$Root = "$env:USERPROFILE\OneDrive - Contoso"
Get-ChildItem -LiteralPath $Root -File -Recurse |
  Select-Object FullName, Name, Extension, Length |
  Export-Csv -Path "$env:USERPROFILE\Desktop\OneDrive-files.csv" -NoTypeInformation -Encoding UTF8

Find names containing Arabic characters

Get-ChildItem -LiteralPath $Root -File -Recurse |
  Where-Object { $_.Name -match '[\u0600-\u06FF]' } |
  Select-Object FullName, Name |
  Export-Csv "$env:USERPROFILE\Desktop\OneDrive-ArabicNames.csv" -NoTypeInformation -Encoding UTF8

The Unicode range is a practical filter, not a complete linguistic test. Review the CSV before making changes, and retain the original file names if the destination platform supports them correctly.