How to loop all excel files and convert XLSX to XLSB

We are using Aspose.cells 8.2.2 version and using following code to convert XLSX to XLSB. We are using static file in code to convert.

string stringBeforeChar = strfilename.Substring(0, strfilename.IndexOf("."));
string strinputfilename = “D:/Shared Files/Split/Input/” + parameters;
string stroutputfilename = “D:/Shared Files/Split/Input/” + stringBeforeChar + “.xlsb”;
string stroutputfilename = “D:/Shared Files/Split/Output/” + stringBeforeChar + “.xlsb”;

var workbook = new Aspose.Cells.Workbook(strinputfilename);
workbook.Settings.CalcMode = CalcModeType.Manual;
workbook.CalculateFormula();
workbook.Save(stroutputfilename, Aspose.Cells.SaveFormat.Xlsb);
workbook.CalculateFormula();

Now the requirement is to loop all XLSX files at required location and convert them one by one to XLSB, may be through loop. Can you suggest steps please.

@Mufaddal53,

See the following sample code to accomplish your task for your reference. You may refer to it and may change it accordingly for your requirements:
e.g.
Sample code:

string outPath = "g:\\OutputFolder\\";
string[] dir = Directory.GetFiles("g:\\InputFolder", "*.XLSX");
foreach (string file in dir)
{
      var workbook = new Aspose.Cells.Workbook(file);
      workbook.CalculateFormula();
      workbook.Save(outPath + Path.GetFileName(workbook.FileName).Replace(".xlsx", ".xlsb"), Aspose.Cells.SaveFormat.Xlsb);
                
} 

Hope, this helps a bit.