程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> .NET網頁編程 >> C# >> C#入門知識 >> csharp: Getting all image files in folder,csharpgetting

csharp: Getting all image files in folder,csharpgetting

編輯:C#入門知識

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         /// 查找文件夾下的圖片
27         /// 2014-08-28 
28         /// 塗聚文
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         }

 


tomcat安裝出現No Java Virtual Machine found in folder:C:\program Files

java的環境變量配了嗎?
這個文件路徑改成你的jre路徑,在安裝tomcat時候可以改這個的。
 

given the files and folder in slide 15, assuming the working directory now is "C:\WP\Backup", what

在第15張幻燈片給出文件和文件夾,假定當前的工作目錄是:"C:\WP\Backup"。

別只復制一句話啊,一段發上來,比較好翻譯。
 

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved