Today, I briefly touched on the C # file management class and made a simple understanding of the general functions of the class;
The project is used to determine whether a file is saved, create a file, and delete a file. The file retrieval function is summarized as follows:
Public String GetFile () {// get the string files = ""; string [] wenjian = directory. getfiles (server. mappath ("~ /"); Foreach (string item in wenjian) {fileinfo info = new fileinfo (item); Files + =" file name: "+ info. name + "; file type" + info. extension + "; file size:" + info. length + "; Creation Time:" + info. creationtime + "<br/>";} return files;} Public String folder () {// get the string folders = ""; string [] WJ = directory. getdirectories (server. mappath ("~ /"); Foreach (string item in WJ) {directoryinfo info = new directoryinfo (item); folders + =" folder name: "+ info. name + "<br/>";} return folders ;}