Rename files in folder

Hello,

I have a folder that includes files with and without - ABC.
All files need to end in - ABC

How do I rename the files without it?

Use Move activity to rename the files, after retrieving them.

Hi
hope these steps would help you resolve this
–use a assign activity like this
arrFiles = Directory.GetFiles(“yourfolderpath”)

–now use a FOR EACH activity and pass the above variable as input and change the type argument as string
–inside the loop use a IF condition like this
NOT Path.GetFileNameWithoutExtension(item.ToString).ToString.Contains("-ABC")
if true means the file has no such term in it and thus goes to THEN part where we can use a MOVE FILE activity like this
in the source path mention as item.ToString and in the Destination Property mention as Path.GetFileNameWithoutExtension(item.ToString)+"-ABC"+Path.GetExtension(item.ToString)

Cheers @sparkplug93

1 Like

Perfect, thank you

Cheers @sparkplug93

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