I suggest you really think deeply about whether or not you actually need to recursively get the filepaths of
all files, in all directories, in a drive ! I'd guess you don't need to do that, and that you will want to filter the results by some criteria, like file-extension, etc.
First, as Garth points out to you in his reply, you definitely
should use .NET 4.0 and later's 'EnumerateFiles method rather than 'GetFiles [
^]:
"The EnumerateFiles and GetFiles methods differ as follows: When you use EnumerateFiles, you can start enumerating the collection of names before the whole collection is returned; when you use GetFiles, you must wait for the whole array of names to be returned before you can access the array. Therefore, when you are working with many files and directories, EnumerateFiles can be more efficient."
You can find excellent examples, and techniques, for creating efficient file searches using various options, and Linq, with EnumerateFiles here: [
^].