I am getting all files in a directory by following code.
IEnumerator FILES = Directory.GetFiles(
                DIRECTORY_PATH).GetEnumerator();
How can I get the total number of files? There's no FILES.Count();
I am getting all files in a directory by following code.
IEnumerator FILES = Directory.GetFiles(
                DIRECTORY_PATH).GetEnumerator();
How can I get the total number of files? There's no FILES.Count();
 
    
    Directory.GetFiles(@"C:\yourdir").Length
will give you count directly
 
    
    First you can get your files string[], count the numbers in it, then get your enumerator:
string[] files = Directory.GetFiles(DIRECTORY_PATH);
int count = files.Length;
IEnumerator enumerator = files.GetEnumerator();
 
    
    If you really want to stick with "GetEnumerator()" ...
IEnumerator files = Directory.GetFiles(DIRECTORY_PATH).GetEnumerator();
int count = 0;
while (files.MoveNext())
{
    count++;
}
// after this loop you will have total files count in count varibale.
