Directory for every file extension (Better organization)
This will prevent users to fetch everything at once in a single directory.
There is a list that keeps track of all existing file types. After building an entry list, it will create separate directories with extension names.
Temporary solve:
var pathToExtract = $"{outputDirectory}/{fileExtension.ToUpper()}";
if (!Directory.Exists(pathToExtract)) Directory.CreateDirectory(pathToExtract);
File.WriteAllBytes(Path.Combine(pathToExtract, $"{fileEntry.Hash:X16}.{fileExtension.ToLower()}"), bytes);
@LinkOFF7 Thanks, but that would cause excessive IO checks. @steffalon version is a one-off thing for that.
I'd have to look into the best approach here, even when you put all files in a folder based on their types, some folders would still contain thousands of files.
Maybe like that (begin of ExtractFileEntryList function):
foreach(var ext in fileEntryList)
{
var extension = new string(ext.FileType.ToCharArray().Reverse().ToArray());
Directory.CreateDirectory($"{outputDirectory}/{extension}");
}
Maybe creating more sub directories based on 2 hex values of a file name? For example:
/JSON
/FF
/0E