Use list to get the contents of the file uploaded to the directory for pagination display

Source: Internet
Author: User

Public list<model> GetFileName (string filePath)
{
var queryparam = Queryjson.tojobject ();
string[] filepaths = directory.getdirectories (FilePath);//Get all folder paths under directory
string[] fileNames = null; Declaring an empty array

ArrayList array = new ArrayList ();

list<fileword> lst = new list<fileword> ();
for (int i = 0; i < filepaths.length; i++)//Loop Get file name
{
FileNames = Directory.GetFiles (Filepaths[i]);//Put the file name in the array
foreach (var item in FileNames)//Add file name to ArrayList
{
Array. ADD (item);
}
}
for (int i = 0; i < array. Count; i++)
{
Model FW = new Model ();
File path
String FilePath = Array[i]. ToString (). Replace ("\ \", "/");//convert \ \ to/
Folder name
String templateclass = filepath.substring (0, Filepath.lastindexof ("/"));
String FName = Filepath.substring (Filepath.lastindexof ("/") + 1);
Fw. FName =fname.substring (0,fname.lastindexof ('. '));
Fw. Templateclass = templateclass.substring (Templateclass.lastindexof ("/") + 1);
Lst. Add (fw);//Adds a class to the LST collection
}


LST = lst. Skip (Number of pages * rows-number of lines). Take (number of rows). ToList ();//linq Group
return LST;
}

Use list to get the contents of the file uploaded to the directory for pagination display

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.