Split the File name


I want to split the multiple zip file name how can i do that
AGTPR3871K_CVLKRA_20230707_171420 this is the zip file
i want the output like this-AGTPR3871K

iam using unzip activity inside for each and iam using assign inside loop and writing the code currentitem=split(β€œ_”)(0) but it is not working

Hi @Priyesh_Shetty1

Try this:
Result = str_Path.Split(β€œ_”.ToCharArray)(0)

You need to give file path like currentitem(because u are using for each to iterate the files)


Try variable = currentitem.split(β€œ_”.tochararray)(0)

Hi @Priyesh_Shetty1

How about the following RexEx pattern:



UiPath Syntax - Assign Activity:


Hope this helps,
Best Regards.

Hi @Priyesh_Shetty1

Try this



Thank you

Hi @Priyesh_Shetty1 ,

You have not used the for each instance variable for splitting in the expression :

startName = Split(currentItem.ToString,"_").First

startName is a string variable and it should contain the starting name of file.

1 Like


After using ur code it is showing error

@Priyesh_Shetty1 ,

Could you let us know why is a Split of the file name being performed ?

It seems the value that you should pass to the Files to Extract property should be currentItem only and not the splitted name.


Iam splitting the file name because as per user he want all the file name to be pasted in excel
so these file name are in zip format. and my file is also getting pasted
But it is pasting in this format AGTPR3871K_CVLKRA_20230707_171420 in excel

@Priyesh_Shetty1 ,

For the Extract/Unzip files activity you would need to pass the full file path. it would not work otherwise.

And for the file name update in Excel, Could you show us where is that part of code ?


This is the output iam getting

@Priyesh_Shetty1 ,

We want to look at the code where the Excel is getting updated.

Do show us the screenshot of that part of the workflow, so to conclude on the changes to be done.


Use this in assign Activity:

lv_Output= lv_Filename.Split(β€œ_”.ToCharArray)(0)

Hope this works!

@pratik.pandya it doesnt work

@pratik.pandya it is a zip file name so iam using unzip activity,in for each loop

@Priyesh_Shetty1 ,

From the Screenshots provide we can only see the update happening with the Excel sheet using Write Cell activity. The value used in it is CurrentItem.FolderName.

We assume this is the area that needs to be modified although it is not very clear. Hence, Before the Write Cell activity, Could you try using Write Line activity to write the CurrentItem.FolderName to the Output Panel and check the value that is being written.

This is to understand if the area to be modified is the same.


CurrentFolder.Name is giving the file name