Get first letter of the folder

How to get the first letter of each folder in a specific path?

Hi!

Have a view on this

Regards,
NaNi

HI @prititit

Try these steps to get first letter

  • Use for each folder in folder activity
    • System.Text.RegularExpression.Regex.Match(Currenfolder.Name,"^\S").ToString

image
image

This will get the first letter of folder

Regards
Gokul

@prititit

If you are using new studio and you need the first letter of the current folder only then use @Gokul001 suggestion

Else you can try as below

Use Assign activity, create a string variable let’s say arrFolder

arrFolder = Directory.GetDirectories(“FolderPath”)

image

Now use For Each activity and give the arrFolder

Now inside that you can place a assign if you want to store the result in a variable

For demo purpose I placed a message box and write as below

path.GetFileNameWithoutExtension(item.ToString).Substring(0,1)

image

Hope this will help you

Thanks

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