0

I have seen questions answered where people use the GetFiles method in a loop and pass some filter like *.mp3|*.wav

I am looking for all files, i.e. *.* in the directory and it's subdirectories (there are many files). Users can choose to ignore specific filters (dynamic) when getting the files. The problem is that all getting all files and then removing files of a type will leave the list almost empty, but it takes a lot of time to get the files. Which is not ideal.

 

Use case:

GetFiles *.* returns 300,000+ files

280,000+ of them are jpg files

GetFiles *.jpg returns these 280,000+ files

Remove these 280,000+ files from 300,000+ files leaving only 20,000 or so files

 

It takes a lot of time to do this process. Is there a simpler way of doing this? Any help appreciated, thanks.

Klaus Gütter
  • 11,151
  • 6
  • 31
  • 36
Shraa1
  • 149
  • 9
  • Does this answer your question? [Retrieving files from directory that contains large amount of files](https://stackoverflow.com/questions/7865159/retrieving-files-from-directory-that-contains-large-amount-of-files) – devNull Aug 18 '20 at 13:38
  • I think it would. I'll give it a try later. – Shraa1 Aug 18 '20 at 13:42
  • I'll still prefer knowing the answer for before .Net 4 – Shraa1 Aug 18 '20 at 13:43

0 Answers0