Csharp: Getting all image files in folder, csharpgetting
1 // <summary> 2 // 3 /// </summary> 4 /// <param name = "sender"> </param> 5 // <param name = "e"> </param> 6 protected void Page_Load (object sender, eventArgs e) 7 {8 if (! IsPostBack) 9 {10 path = Server. mapPath ("images/"); 11 12 String searchFolder = path; 13 String [] filters = new String [] {"jpg", "jpeg", "png ", "gif", "tiff", "bmp"}; 14 String [] files = GetFilesFrom (searchFolder, filters, false); 15 for (int I = 0; I <files. length; I ++) 16 {17 Response. write (files [I]. toString () + "<br/> "); 18} 19 20 21} 22 23 24} 25 // <summary> 26 // find the image in the folder 27 /// 2014-08-28 28 /// Tu juwen 29 // </summary> 30 // <param name = "searchFolder"> </param> 31 // <param name = "filters"> </ param> 32 // <param name = "isRecursive"> </param> 33 // <returns> </returns> 34 public static String [] GetFilesFrom (String searchFolder, string [] filters, bool isRecursive) 35 {36 List <String> filesFound = new List <String> (); 37 SearchOption searchOption = isRecursive? SearchOption. allDirectories: SearchOption. topDirectoryOnly; 38 foreach (string filter in filters) 39 {40 filesFound. addRange (Directory. getFiles (searchFolder, String. format ("*. {0} ", filter), searchOption); 41} 42 return filesFound. toArray (); 43}
When tomcat is installed, No Java Virtual Machine found in folder: C: \ program Files appears.
Is the java environment variable configured?
Change the file path to your jre path. You can change this path when installing tomcat.
Given the files and folder in slide 15, assuming the working directory now is "C: \ WP \ Backup", what
The files and folders are displayed on the first slide. Assume that the current working directory is "C: \ WP \ Backup ".
Don't just copy one sentence. It's better to translate it.