//遍历本文件夹中的文件及子文件夹中的文件:
/*newpath = Directory.GetFiles(newsecpath, "*.*",
SearchOption.AllDirectories).Where(s => s.EndsWith(".png") || s.EndsWith(".jpg")
|| s.EndsWith(".ico")).ToArray();*/
//仅遍历本文件夹中的文件:
newpath = Directory.GetFiles(newsecpath, "*.*",
SearchOption.TopDirectoryOnly).Where(s => s.EndsWith(".png") || s.EndsWith(".jpg")
|| s.EndsWith(".ico")).ToArray();