1

I'm using window server 2008, and i have a folder that contain over one million files.

I want to get list of name of top 100 oldest files in this folder.

Using Window Explorer and it take very very long time (take about 2 days then crash).

Is there any way to do that fastest?

Thanks for any help.

Minh Nguyen
  • 1,989
  • 3
  • 17
  • 30
  • 1
    Surprising .. I didn't know NTFS supported that many files in a directory .. if it *really is* "over one billion files", I do not know of any reasonable approach. –  Sep 14 '12 at 01:59
  • Sorry for my english. I mean a million files – Minh Nguyen Sep 14 '12 at 02:03
  • I think the "best" that can be done is enumerating over the directory info entries (not the files) and building a running-queue of the 100 oldest (so that at most 100 entries need to be kept in memory at once; Explorer is likely trying to load *every* entry at once). This could likely be done in PowerShell .. although I imagine it would still be a relatively lengthy process. –  Sep 14 '12 at 02:05
  • Thanks for your idea. Please show me how to do that? I kown your mean but i don't kown how to do. – Minh Nguyen Sep 14 '12 at 02:11
  • 1
    This is exposed in .NET as [DirectoryInfo.EnumerateFiles](http://msdn.microsoft.com/en-us/library/dd413232.aspx) –  Sep 14 '12 at 02:37

0 Answers0