NtfsLib icon indicating copy to clipboard operation
NtfsLib copied to clipboard

List all directories/files

Open codustel opened this issue 6 years ago • 3 comments

Hi, I'm trying to list all directories & files from my C drive, but it's only give me the first level. how can I use dir.ListFiles() to list all files from all directories in my C drive. I tried a classic recursive method but I think that it's not the fastest way. Is there a native way to do that reading MFT with this library? Thanks

codustel avatar Feb 04 '19 14:02 codustel

NTFS does not support any form of recursive lookups like the Win32 API does. So you'll have to do your own recursion.. (It might be that there is a helper in DiscUtils that can do recursion on any implemented filesystem .. it would seem likely).

What do you mean with "the fastest way" ?

LordMike avatar Feb 04 '19 16:02 LordMike

Thanks for your reply.

What do you mean with "the fastest way" ?

I'm trying to list more than 3M files in less than 2 minutes, as Ultrasearch do it using MFT. I tried NTFSReader, it worked but when I tried it on a GPT disk I had an error, and NTFSReader is no longer maintained unfortunately.

Have you got an idea?

Thanks

codustel avatar Feb 06 '19 00:02 codustel

To do stuff like that, I've iterated all MFT entries in one linear go, and then stitched them together after the fact. This is the fastest, as it moves all operations to in-memory datastructures.

One of the two, I believe it's ~NTFSReader~ NTFSParser, is forward-only, and facilitates this.

LordMike avatar Feb 06 '19 09:02 LordMike