C# 文件详细信息读取 Windows文件一般有名称,修改日期,类型,标题,作者,大小好几十个属性,那要如何取得? 有哪位知道的 我主要是想知道作者 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 第一时间想到了fileinfo 具体的去查MSDN吧 fileinfo只能取到时间,修改者取不到 Win32 SystemInfo好像是这个函数 我只知道调用照片的相机信息用EXIF using System.Net;using System.Windows.Forms; private void GetNetFileInfo(string url) { System.Net.HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Method = "HEAD"; HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Console.WriteLine("修改日期:" + response.LastModified.ToString()); Console.WriteLine("文件大小:" + response.ContentLength + "字节"); response.Close(); } private void GetLocalFileInfo(string path) { System.IO.FileInfo fi = new System.IO.FileInfo(path); Console.WriteLine("Attributes:" + fi.Attributes.ToString()); Console.WriteLine("CreationTime:" + fi.CreationTime.ToString()); Console.WriteLine("LastAccessTime:" + fi.LastAccessTime.ToString()); Console.WriteLine("LastWriteTime:" + fi.LastWriteTime.ToString()); Console.WriteLine("Length:" + fi.Length.ToString()); } 只能取到 strMessage += "Attributes:" + fi.Attributes.ToString(); ... strMessage += "CreationTime:" + fi.CreationTime.ToString(); strMessage += "CreationTimeUtc:" + fi.CreationTimeUtc.ToString(); ... strMessage += "Directory:" + fi.Directory.ToString(); strMessage += "DirectoryName:" + fi.DirectoryName.ToString(); strMessage += "Exists:" + fi.Exists.ToString(); strMessage += "Extension:" + fi.Extension.ToString(); strMessage += "FullName:" + fi.FullName.ToString(); strMessage += "IsReadOnly:" + fi.IsReadOnly.ToString(); strMessage += "LastAccessTime:" + fi.LastAccessTime.ToString(); strMessage += "LastAccessTimeUtc:" + fi.LastAccessTimeUtc.ToString(); strMessage += "LastWriteTime:" + fi.LastWriteTime.ToString(); strMessage += "LastWriteTimeUtc:" + fi.LastWriteTimeUtc.ToString(); if(File.Exists(strPath)) { strMessage += "Length:" + fi.Length.ToString(); } strMessage += "Name:" + fi.Name.ToString(); http://www.codeproject.com/KB/files/detailedfileinfo.aspx using System.Diagnostics;FileVersionInfo fvi=new FileInfo(path); path文件路径fvi.CompanyName;估计就是你要的作者 还有其他属性可以类似获取 C#可以使用哪些嵌入式数据库 模拟题20分 关于截屏代码优化的请教 请教各位大哥,winform登录后怎么把登录信息存到xml中??? GridView 中 Lable控件问题? 怎么将一个登录帐号绑定到一个局域网? 请问如何将一个user对象数组的内容方便的转换为dataset? C#视频教程!~~~~~~~~快来~~~~~~ 如何获取DataGrid每一列的宽度啊? 问两个关于表单的问题? 用c#后台打开一个其它软件然后关闭它 用户控件Load事件后执行什么事件?
SystemInfo
好像是这个函数
{
System.Net.HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "HEAD";
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Console.WriteLine("修改日期:" + response.LastModified.ToString());
Console.WriteLine("文件大小:" + response.ContentLength + "字节");
response.Close(); }
private void GetLocalFileInfo(string path)
{
System.IO.FileInfo fi = new System.IO.FileInfo(path);
Console.WriteLine("Attributes:" + fi.Attributes.ToString());
Console.WriteLine("CreationTime:" + fi.CreationTime.ToString());
Console.WriteLine("LastAccessTime:" + fi.LastAccessTime.ToString());
Console.WriteLine("LastWriteTime:" + fi.LastWriteTime.ToString());
Console.WriteLine("Length:" + fi.Length.ToString());
}
strMessage += "Attributes:" + fi.Attributes.ToString();
...
strMessage += "CreationTime:" + fi.CreationTime.ToString();
strMessage += "CreationTimeUtc:" + fi.CreationTimeUtc.ToString();
...
strMessage += "Directory:" + fi.Directory.ToString();
strMessage += "DirectoryName:" + fi.DirectoryName.ToString();
strMessage += "Exists:" + fi.Exists.ToString();
strMessage += "Extension:" + fi.Extension.ToString();
strMessage += "FullName:" + fi.FullName.ToString();
strMessage += "IsReadOnly:" + fi.IsReadOnly.ToString();
strMessage += "LastAccessTime:" + fi.LastAccessTime.ToString();
strMessage += "LastAccessTimeUtc:" + fi.LastAccessTimeUtc.ToString();
strMessage += "LastWriteTime:" + fi.LastWriteTime.ToString();
strMessage += "LastWriteTimeUtc:" + fi.LastWriteTimeUtc.ToString();
if(File.Exists(strPath))
{
strMessage += "Length:" + fi.Length.ToString();
}
strMessage += "Name:" + fi.Name.ToString();
fvi.CompanyName;估计就是你要的作者 还有其他属性可以类似获取