To open a specific file from a specific folder

Hi all,

I want to open the specific file inside a specific folder. This folder name is known before as it is saved as a variable previously.

For eg: \ssiiasauto\auto\class\set. This is the file path.
Inside the “set” folder I need to look for the folder “ABCD2020” which is known before as its a variable saved before.

Inside this “ABCD2020” folder, I need to open a specific file in notepad format.
File name is : " “ABCS2020.CS” (same name as of folder)

FolderPath = \ssiiasauto\auto\class\set
FileName (Variable) = ABCD2020
(Variable name= strCode)
File name - ABCD2020.cs

Any help is greatly appreciated.

Thanks:)

@Christin_John - Please try like this…

image

Replace ABCD2020 with your variable name…

@Christin_John,

You can use below code,
// Create String array variable
strArrFiles = Directory.getFiles(“FolderPath\ABCD2020”, “ABCD2020.cs”)
// use for each to iterate
For each files in strArrFiles{
// open your file
}

If my variable name is set as “strCode”

“\ssiiasauto\auto\class\set” + “strCode” + “strCode” + “.cs”,
do I need to enter in the filename field?

Try like this…

"\ssiiasauto\auto\class\set\" + strCode + "\" + strCode + ".cs"

Thank you so much @prasath17 . It worked :slightly_smiling_face:

1 Like

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