Hi, I want to access all the files and subdirectories of a file table (Sql).
I can access the root directory "WebApiUploads_Dir" and return all the files on my interface.
However, I don't see all the subdirectories and I would like to access them to see the content
Controller
[HttpGet]
public async Task<IActionResult> GetAsync()
{
string directory = await _fileRepository.GetFileTableDirectory("WebApiUploads_Dir");
string[] files = Directory.GetFiles(directory).Select(f => Path.GetFileName(f)).ToArray();
return Ok(files);
}
I can acces to subdirectory if I had ("WebApiUploads_Dir\Subdir1");
But In this case I see only the content of the Subdir1
Plus I have ten subdir.
The definition of GetFileTableDirectory
public async Task<string> GetFileTableDirectory(string fileStreamDirectory)
{
FileTableRoot results = await _context.Set<FileTableRoot>().FromSqlRaw("SELECT FileTableRootPath() as Name").FirstOrDefaultAsync();
return $"{results?.Name}\\{fileStreamDirectory}";
}
Can you some advise to achieve it or some example?
Thanks in advance