String [] format = {"*. jpg ","*. doc ","*. EXE ","*. PDF ","*. xls "}; C # file stream operation-delete, copy, and transfer multiple files /// <summary> /// delete all the images in the folder /// </Summary> /// <Param name = "oldpngpath"> file path to be deleted </param> // <Param name = "newpngpath"> new directory to be deleted </param> /// <Param name = "geshi"> the format of the Operation file is as follows: *. PNG ,*. XML </param> Public void deleteall (string delpath, string format) {string [] files = directory. getfiles (delpath, format [0]); foreach (string file in files) {file. delete (File );}} /// <summary> /// copy all the images in the folder /// </Summary> /// <Param name = "oldpngpath"> path of the file to be copied </param> /// <Param name = "newpngpath"> the new directory to be copied </param> /// <Param name = "geshi"> the format of the Operation file is as follows: *. PNG ,*. XML </param> Public void copyall (string oldpngpath, string newpngpath, string format) {string [] files = directory. getfiles (oldpngpath, format [0]); foreach (string file in files) {string otherfile = path. combine (oldpngpath, path. getfilename (File); file. copy (file, newpngpath + "\" + path. getfilename (File ));}} /// <summary> /// move all files in the folder /// </Summary> /// <Param name = "olderpath"> file directory to be moved </ param> // <Param name = "topath"> new directory </param> Public void moveall (string olderpath, string topath) {string [] files = directory. getfiles (delpath, format [0]); foreach (string file in files) {file. move (file, topath); // move the file }}