How to get String data from zip file name from a folder



Hello!

In this there are 3 folders inside that folder’s there are multiple zip file’s available.
I just want to get the starting name that is only pan no’s and i want to paste that name in excel under the column name of the folder’s

Like example CAMS
So under that i want to paste all the pan available inside that,so i want to do this for all folder’s.

@Priyesh_Shetty1
Code Flow:

  1. Set a variable mainFolderPath with the path to the main folder containing the subfolders.
  2. Use the “Directory.GetDirectories” activity to get a list of all subfolders inside the main folder.
  3. Use a “For Each” activity to iterate over each subfolder.
  4. Inside the “For Each” loop, use the “Directory.GetFiles” activity to get the list of zip files within the current subfolder.
  5. Use another “For Each” activity to loop through each zip file in the current subfolder.
  6. Inside the second “For Each” loop, use the “Path.GetFileNameWithoutExtension” activity to retrieve the filename without the extension.
  7. Split the filename using the underscore character “_” as the delimiter.
  8. Get the first part of the split filename, which corresponds to the PAN number.
  9. Append the PAN number to a list or string variable specific to the current subfolder.
  10. After both “For Each” loops, use the “Write Range” activity to write the PAN numbers to an Excel file. Each subfolder name will be the column name, and the corresponding PAN numbers will be listed under each column.

@raja.arslankhan How should i do that iam stucked on point 7th split part

@Priyesh_Shetty1
Split(FileName,“_”)

@Priyesh_Shetty1
Split expression:
Use assign activity inside loop.

FileCodeVar= split(YourFileNameVar, “_”)(0)

@raja.arslankhan


Ur half code worked till split and i got all the pan’s

Know i want to paste that Pan’s under the column of above image sometime different name folder’s will also be added so ill add that name in build data table also
How can i paste that pan numbers under the column of that folder name?
Example-i want to paste all CAMS pan number under CAMS column

Like this i want to do,And i want this all pasted data to be in mail body.

@Priyesh_Shetty1

Now you have list of strings…

You can use geenrate datatable using "FolderNameYouNeed" + Environment.NewLine + string.Join(Environment.NewLine,Listvar)

This will make sure a dtaatable with the column name as folder and values as the list of pan in each row

Cheers

@Anil_G


I want the output like this CVLKRA is the folder names inside that there are pan number’s so i want to past each folder name data under the column of that folder name,And daily the folder is not fixed some time there are only 2 folders sometime 4 folders but these name are all fix.