Changing the folder names in the directory

Hello Everyone,
I would like to ask your help on the automation part where I can change the folder folder names with few conditions let’s say I want to remove the date and underscores from the name.

Thanks

Hi @aditya.bhandwalkar

Can try like this?

Step 1: Use invoke Method activity and specify properties as below:
TargetType: System.IO.Directory
TargetObject: (Dont specify anything)
MethodName: Move

Parameters:

  1. Specify source directory Path
  2. Specify Target directory path

Hope this will be helpful. Thank you.

@aditya.bhandwalkar

Please use the code as inline screenshot.

Parameters should be old and new values. If you have many folders to do so, kindly loop through.

Code:
RenameExistingFolder.xaml (4.4 KB)

Hope this will be helpful. Thank you.

1 Like

You can use “Rename Folder” Activity

image

1 Like

Check attached code:
Sequence9.xaml (6.1 KB)

1 Like

Hello thanks for your code could you please tell me what shaould be the value in FolderPath ? is it actual path and value in the rename folder activity.

I think this activity we can use only inside VM Scope since it’s came from a dedicated Server Virtualization package.

The method I used in the previous post using .Net classes only. If you are comfortable with that, please use it.

Thank you

we can use the RenameDirectory Method for changing a folder name:

for calculating the new name, just share some sample values with us and we can help based on this. Thanks for support

FolderPath is your actual, full, folder path.
i.e. “C:\Users\UserName\Documents\FolderName 11-02-2021”
The workflow then extracts its last part into oldName variable, which then is modified according to your requirements.

Sorry, invalid documentation link

But I got the error of source folder is missing. I have multiple folders in one folder so lets say in my ‘mainfolder’ I have different folders for which I have to change names