PDA

View Full Version : سوال: تشخیص فایل هایی که به صورت سیستمی مخفی شده اند



amirrr3
پنج شنبه 27 بهمن 1390, 17:08 عصر
با سلام به دوستان عزیز انجمن
من می خوام توسط system.io فایل هایی رو از هارد درایو فراخوانی کنم که این فایل ها به صورت سیستمی مخفی (هیدن) هستن
از دوستان تقاضا دارم راهنمایی کنن ممنون میشم

b.saminjad
پنج شنبه 27 بهمن 1390, 17:39 عصر
سلام
از کد زیر استفاده کن



System.IO.FileAttributes x= System.IO.File.GetAttributes("-----");
if (x == System.IO.FileAttributes.System)
MessageBox.Show("System File");

b.saminjad
پنج شنبه 27 بهمن 1390, 19:13 عصر
برای تشخیص همه فایلهای سیستمی از کد زیر استفاده کن


DriveInfo[] d = DriveInfo.GetDrives();


foreach (DriveInfo x in d)
{

//----------------------------------------------------------------------------------------------------
if (x.IsReady == true)
{
//------------------------------------------------
string[] y = Directory.GetDirectories(x.Name);
foreach (string n in Directory.GetFiles(x.Name))
{
string att = File.GetAttributes(n).ToString();
if (att.IndexOf("System") !=-1)
{
listBox1.Items.Add(n);

}
}


//-------------------
foreach (string n1 in y)
{

if(n1!= ( x.Name + "System Volume Information"))
foreach (string n in Directory.GetFiles(n1))
{
string att=File.GetAttributes(n).ToString();

if (att.IndexOf("System")!=-1)
{
listBox1.Items.Add(n);

}
}


}
//--------------------------------------

}
//------------------------------------------------------------------------------------------

}
//------------------------------------------------------