Csharp: Getting all image files in folder, csharpgetting

Source: Internet
Author: User

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.
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.