I have to add suffix like _1 and _7 for single file

I have to suffix like _1 and _7 for single file

Input

Output:

Thanks
Shaik Muktharvalli

1 Like

Hope the below steps would help you resolve this

  1. Use a assign activity like this

arr_files = Directory.GetFiles(“your folderpath”)

Where arr_files is a variable of type array of string

  1. Now use a FOR EACH activity where pass the above array variable as input and change the type argument as string

  2. Inside the loop use a COPY FILE activity where pass the source as item.ToString
    And destination mention as Path

“your folderpath” +”\“+System.IO.Path.GetFileNameWithoutExtension(item.ToString)+”_1”+System.IO.Path.GetExtension(item.ToString)

And another copy file activity like this within the same loop

“your folderpath” +”\“+System.IO.Path.GetFileNameWithoutExtension(item.ToString)+”_7”+System.IO.Path.GetExtension(item.ToString)

https://docs.uipath.com/activities/other/latest/workflow/copy-file

Hope this helps

Cheers @shaik.muktharvalli1

Hi @shaik.muktharvalli1 ,

Could you maybe check with the below Configuration, Essentially I believe we would require to use Two Copy File activity for the same file to rename with _1 and _7 :

Expression used in Copy File :

Path.Combine(CurrentFile.DirectoryName,Path.GetFileNameWithoutExtension(CurrentFile.FullName)+"_1"+CurrentFile.Extension)

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