Read text files from specific subfloders

Hi,
I have a main folder that contain subfolders with text files.
I need to read only specific subfolders(a506,a324,b5543,t55) at times from a given list (d445,a506,a324,y6635,b5543,t55,h7732) and search(typeinto) text files of that subfolders into webrowser accordingly.
The main folder may contain 5 subfolders at times or 6 subfolders or maybe all subfolders from the given list i.e (d445,a506,a324,y6635,b5543,t55,h7732). So i need to iterate through the given list of subfolder and check if it the first subfolder is present and search text file into web and repeat same process for whole list of subfolders
Can someone help me to read text file from these subfolders under condition that is mentioned.
Rightnow i am able to read all subfolders and text files.

Hi @afzaal0555


Directory.GetFiles("YourPath","*.txt",SearchOption.AllDirectories)

this will get you the text files from all the subfolder

YourPath- Your main Folder Path

Regards
Sudharsan

Sorry you want only the specific folders?

@Sudharsan_Ka
I am able to read all text files from subfolders. The problem is that i need to check if the subfolder from the given list of subfolder is present and if it is present then read text file from it and search into web and repeat this procedure for whole list

@Sudharsan_Ka
yes. I need to read specific subfolders

Steps to be followed

  • With these two you can get your solution my guess
    image

  • Your condition will something like this?
    image

Hope it helps you

Regards
Sudharsan

2 Likes

Thankyou sir. My problem is sorted out.
cheers!.

1 Like

That’s Great

Happy Automation…

Kindly mark your Solution and close the topic it will help others.

Regards
Sudharsan

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