To read files from multiple(2 or more) directories

Hey all,

How to read files from one or more directories/folders.

Please let me know if this is possible.

Thanks in Advance.

Use System.IO.Directory.GetFiles(MyPath), where MyPath is the primary folder.


Here MyPath-- can hold just one path to one particular folder, is it?

That’s for 1 path. You could store other paths using the same syntax.

can we use both in the same loop?

This method would require separate loops for each path.

Isn’t there any other way??

It depends on your setup. If these are subdirectories, there is another way, but if these are completely separate directories, the only other way would be to reconstruct a new list or array of paths and then make one iteration.

these are separate directories.