Renaming folder not giving correct result

I need to rename all the files available inside root folder with only number.
logic


All the three folders to be rename as
345708,353220 etc text in the folder needs to be removed

But getting this renamed to System.String

@shashank_dullu

Looks like new name is array of string…

Use newname(0)

Cheers

@shashank_dullu

newname is a array of string type you need to call it by its index

check it once

@Shiva_Nikhil & @Anil_G - How can I add multiple Delimiter in same string manuplation

getting error at rename folder activity

@shashank_dullu

i think the error is because for every iteration you are providing the same Folder name

newname(0)

can you tell what was your requirement ?

Inside main folder I have multiple folder as mentioned below


In these name I need to remove the text part and only keep number in the folder name . For which I am using Folder in folder as the no of folders are dynamic in main folder

Delimiter in the folder can be ‘-’ or ‘_’

@shashank_dullu

Str_name.Split({"-","_"},StringSplitOptions.none)

try this once

Str_name.Split({"-","_"},StringSplitOptions.none)(0)

Change NewName to String, not Array of String. In the Assign where you set NewName, Split returns an array so put (0) on the end of the Split expression to get the first element in the array.

@shashank_dullu

As per log the folder you are getting is 123… and as _ is not present …it is using same string which is not possible

Cheers

Renaming to the same name it already has generates a specific error:

image

Which is not the error they’re getting. The error they’re getting is because they’re trying to pass an array variable with .ToString as the New name.

Hi @shashank_dullu

If you want to rename with the numbers then try below way

Str_name.Split("-").First

Above result will be numbers
If you want to rename after the - then try below way

Str_name.Split("-").Last

This will return letters.

Hope it helps

@postwick

Newname(0) is being passed which is a string and not array

If you observe flow and log messages then newname log and old name log are same values

Cheers

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.