travisowens
Centurion
Counting all the files in a directory tree (resolved)
THIS PROBLEM IS RESOLVED
I simply want to count all the files (of a certain file extension) in a folder & all of it's subfolders. I came across this code on another forum but it only returns 0.
So I changed changed it as it seems the poster forgot one of the requirements was to support subfolders so I changed it like so:
Any ideas? Even when the extension is "*.*" it fails, and this folder tree has 14,000+ files, some in the root folder and tons in many sub folders.
THIS PROBLEM IS RESOLVED
I simply want to count all the files (of a certain file extension) in a folder & all of it's subfolders. I came across this code on another forum but it only returns 0.
C#:
return System.IO.Directory.GetFiles( sFolder , sExtension ).Length;
C#:
return System.IO.Directory.GetFiles( sFolder , sExtension , SearchOption.AllDirectories ).Length;
Last edited: