Flow: Rename Files in OneDrive For Business That Have Dots, Periods or Special Characters

Greetings Flow Fans.

This process essentially strips dots and special characters from existing files that reside within OneDrive or OneDrive for business, it renames them then overwrites the existing file with the newly named version. This has been created as part of a request by Frixel from the Flow Community.

Note: The "List files in folder" action only lists 20 files OOTB and doesn't list files in sub folders either.

Here is a glimpse of the completed Flow that will be broken down step by step below.

We will now go to step 1 in building the Flow and kick things off manually with a button.

Now list the files in the folder.

Initialise some variables.

Would you like to buy Alan a coffee?

Visit the AlanPs1 Ko-fi page

createArray('.','@','ß','²','³','µ','`','´','°','^','=','(',')','&','$','§', '~','#','%','*',':','<','>','?','/','|',' ')

Time to set an "Apply to each" to target the files in the OneDrive folder with a condition within.

There is no need to utilise the No branch here so the yes branch is below.

concat('.', last(split(items('Apply_To_Each_File_in_Folder')?['Name'], '.')))

replace(variables('Sanitise'), item(), ")

This process will now work for all file types due to the variable "FileExtension" capturing whichever extension the file has and re-applying it at the end.

Thanks, Alan

Do you need assistance building this Flow?

Visit the Get Help section of the Power Automate Community