There's a Rename folder action that is available in PAD under the "Folder" actions group. It can only rename one folder at a time and you need to specify the folder name.
So, if you want to simply remove whitespaces, a simple way to do it would be following this:

What it does is as follows:
- Get subfolders in folder will get you the folders in some root directory. I've used a filter with * * which will return any folders that have whitespaces in their names.
- For each is a type of loop that iterates through a collection (in this case a list of folders returned by the previous action) and stores the current item into a variable %CurrentItem% for each iteration.
- Replace text with regular expressions to replace \s (which represents a whitespace in regular expressions language) with %""% (which represents an empty string in PAD). Replace whitespaces in %CurrentItem.Name% and store the output into a new variable, like %NewName%.
- Rename folder to change the name of %CurrentItem% to %NewName%
- End loop
Here's a code snippet you can copy and paste directly into your PAD flow designer to have these actions created for you:
Folder.GetSubfolders Folder: $'''C:\\RPA''' FolderFilter: $'''* *''' IncludeSubfolders: True FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Subfolders=> Folders
LOOP FOREACH CurrentItem IN Folders
Text.Replace Text: CurrentItem.Name TextToFind: $'''\\s''' IsRegEx: True IgnoreCase: False ReplaceWith: $'''%''%''' ActivateEscapeSequences: False Result=> NewName
Folder.Rename Folder: CurrentItem NewName: NewName RenamedFolder=> RenamedFolder
END
Note: You will need to change the directory from which subfolders should be retrieved in Get subfolders in folder.
-------------------------------------------------------------------------
If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.
I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.