Hello,
I try to find the size of a directory.
I found a method with system.io c #.
But it does not like me.
So I turned to WMI.
I tried various syntaxes but none works.
This puts me "invalid request".
I searched on the net and on msdn.
The syntax for the path is a doubling of \.
In niveeau of MSDN, I found the need here
Http://msdn2.microsoft.com/en-us/library/aa394130.aspx
Do you have an idea?
Thanks for your help because I admit that I was running out of ideas.
String myReq = "SELECT * FROM Win32_Directory WHERE Path='\certif\'
AND Drive='e:'";
ManagementObjectSearcher disk = new
ManagementObjectSearcher(myReq);
ManagementObjectCollection moc = disk.Get();
foreach(ManagementObject mo in moc){
//this results below is associated to one result
of the query SELECT * FROM //Win32_Directory
//update2
//\certif\
//A200742N8187
//e:
if (mo != null)
{
if(mo["FileName"]!=null)
Console.WriteLine(mo["FileName"].ToString());
if(mo["Path"]!=null)
Console.WriteLine(mo["Path"].ToString());
if (mo["CSName"] != null)
Console.WriteLine(mo["CSName"].ToString());
if (mo["Drive"] != null)
Console.WriteLine(mo["Drive"].ToString());
if (mo["FileSize"] != null)
Console.WriteLine(mo["FileSize"].ToString());
if(mo["Name"]!=null)
Console.WriteLine(mo["Name"].ToString());
}
}