Hi,
I have a CSV file at particular location.
i want to first check if the file exist and then if the file is present then read that file.
The Problem is the file name is dyanamic but there this a fixed name pattern at the starting part as below
ALL.CMR911 Easysuit Migration_ is the fixed starting part of the filename.
So please anyone can help out to solve this issue.
If we need to file.exists then we need to get exact file name …so can you tell me what comes afterwards at the end of file ?
cant we search the files in the folder that starts with the above filename format, because the end part is dynamic
@vishal_nachankar - Yes you can search and if there is multiple files then it will return the result in string.array…will that be ok?
is it is totally fine if that folder has multiple files as once i read the file i will move that file to the achieve folder
@vishal_nachankar - here you go…
StrArrFiles = Directory.GetFiles(YourPath," *ALL.CMR911 Easysuit Migration_ *)
Remove the space before the * …added just to show that…
ppr
(Peter Preuss)
March 26, 2021, 4:33pm
7
@prasath17 gave the right statement but the editor was interpretating it as fomat assignments
his answer formatted with the </>
button:
StrArrFiles = Directory.GetFiles(YourPath," *ALL.CMR911 Easysuit Migration_* )
1 Like
Yameso
(Jakub Swiderski)
March 27, 2021, 8:30am
8
I think the right one:
StrArrFiles = Directory.GetFiles(YourPath,"*ALL.CMR911 Easysuit Migration_*.csv" )
Because your were looking for csv
And to check if there is result:
If with condition StrArrFiles.Count > 0
system
(system)
Closed
March 30, 2021, 8:31am
9
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.