how to get all files from folder and subfolders in csharp

Code Example - how to get all files from folder and subfolders in csharp

                
                        public static List<String> GetAllFiles(String directory)
        {
            return Directory.GetFiles(directory, "*", SearchOption.AllDirectories).ToList();
        }
                    
                
 

get all files in all subdirectories csharp

                        
                                Directory.GetFiles(dirPath, "*", SearchOption.AllDirectories)
                            
                        
 

csharp list all files in a directory and subdirectory

                        
                                string[] allfiles = Directory.GetFiles("path/to/dir", "*.*", SearchOption.AllDirectories);
                            
                        
 

list all files in directory and subdirectories csharp

                        
                                string[] entries = Directory.GetFileSystemEntries(path, "*", SearchOption.AllDirectories);