C#???????????????
???????????? ???????[ 2016/4/27 10:43:48 ] ??????????????????? .NET
??????? 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);//?????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11