日期:2014-05-17 浏览次数:20790 次
private void Form3_Load(object sender, EventArgs e)
{
string path;
textBox1.Text = DriveInfo.GetDrives()[g].Name;
path = DriveInfo.GetDrives()[g].Name;
DirectoryInfo files = new DirectoryInfo(path);
DirectoryInfo[] dinfo = files.GetDirectories();
try
{
foreach (DirectoryInfo d in dinfo)
//if(File.Open(d.FullName, FileMode.Open).
{
File.SetAttributes(d.FullName, FileAttributes.Normal);
dataGridView1.Rows.Add(
d, File.Open(d.FullName, FileMode.Open).Length
);
}
}
catch (UnauthorizedAccessException x)
{
MessageBox.Show("NO ACCESS");
}