Find excel file in the Directory where file name name starts from particular word

Hi,

I have folder with excel files:
Find Excel
Each month folder will be update and name of excel file will be updated too.
I need to open excel file that starts from word ‘Total’, only word ‘Total’ in the name of excel file will be unchangebale, other parts will be changed.
Which activites should I use to open excel file where name starts from word ‘Total’ and copy sheet content into another excel file?

HI ,

  1. Get the Files list from the Directory where File name Starts with Total
  2. Copy content From Source File to Destination

@Priyanka_Ramesh
I need to scan each file name and find the file that starts with ‘Total’
How to do it?

If System.IO.Directory.GetFiles("C:\Temp\","Total*").Count > 0 Then
str_FilenPath = System.IO.Directory.GetFiles("C:\Temp\","Total*")(0)
end if
1 Like

@AkshaySandhu
Path to the folder is stored like this: “Path.Combine(YourPath,LastMonth)”
Following your suggestion I wrote: System.IO.Directory.GetFiles(“Path.Combine(YourPath,LastMonth)”,“Total*”)(0)
but it gets error: Could not find a part of the path

1 Like

Can you please my command?

in your case it should be like:
System.IO.Directory.GetFiles(Path.Combine(YourPath,LastMonth),“Total*”)(0)

Path.Combine should not be in double quotes

2 Likes

@AkshaySandhu
It worked! Thank you!

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