<summary>
Recursively get all files and folders under the specified drive letter
There is a partial folder access permission issue
</summary>
<param name= "path" >string path = @ "G:\"; </param>
<param name= "Filter" >string filter = "*.mp3";</param>
- private static void Parsedirectory (string path, String filter)
- {
- Get all folder paths under directory
- string[] dirs = directory.getdirectories (path);
- if (dirs. Length = = 0)
- Return
- IEnumerator iter = dirs. GetEnumerator ();
- Traverse folder path and file name under current path
- while (ITER. MoveNext ())
- {
- String str = (string) (ITER. Current);
- Parsedirectory (str, filter);
- }
- Gets the specified content in the specified folder
- string[] files = directory.getfiles (path, filter);
- if (Files. Length > 0)
- {
- M_pathlist.add (files);
- }
- }
recursion (recursion): Programming skills that the program calls itself.
Recursion satisfies 2 conditions:
1) There is a process of repeated execution (call itself)
2) There are conditions for jumping out of the iterative process (recursive exit)
Recursively get all files and folders under the specified drive letter