Method to get all files within folder and subfolders that will return a list March 6, 2023 by Tarik You can use Directory.GetFiles to replace your method. Directory.GetFiles(dirPath, "*", SearchOption.AllDirectories)