??????? using System.IO;
????1) ???·???·??
????string fullfolder = HttpContext.Current.Server.MapPath(folder);
????2) ??????(????)
????File.Move(Server.MapPath("/a.txt")?? Server.MapPath("/b.txt"));
????3) ???????
????File.Copy(Server.MapPath("/a.txt")?? Server.MapPath("/b.txt")?? true);
????4) ?????????
????File.Exists(filefullname)
????5) ????????
????Directory.Exists(fullfolder))
????6) ??????
????Directory.CreateDirectory(fullfolder);
????7) ?????
????Directory.Move
????8) ?????????
????StreamReader srd = File.OpenText(fullfilename);
????srd.ReadToEnd();
????srd.Close();
????srd.Dispose();
????9) д???
????StreamWriter swr = File.CreateText(Server.MapPath("test.txt"));
????swr.Write("message");
????swr.Close();
????swr.Dispose();
????10)??????
// ????????????
if (File.Exists(filefullname))
{
File.Delete(filefullname);
}
????11)??????
public void ListFiles(string pathname)
{
// ???????????
string[] subDirs = Directory.GetDirectories(pathname);
string[] subFiles = Directory.GetFiles(pathname);
foreach (string subDir in subDirs)
{
ListFiles(subDir);
}
// ???????
foreach (string subFile in subFiles)
{
string filename = Path.GetFileName(subFile);
}
}
????12)?????????
????FileInfo fi = new FileInfo(@"c: est.txt");
????DateTime writetime = fi.LastWriteTime;
????13)???·???????????????????
????System.IO.Path.GetFileName(fullPath);//?????