I'm trying to query the filesystem on a remote machine in order to get a list of file names in a specific directory.
Until now, I'm using the DirectoryInfo class in .NET. Something like this:
DirectoryInfo dir = new DirectoryInfo("c:\dir");
FileInfo[] files = dir.GetFiles("*.*");
But this query answers in an average of 20/30 seconds. Sometimes is lasts 50 seconds. That's to much. I want to optimize it. After some googling I've found that this could be done with WMI. But I'm not getting any success. I'm getting errors like "RPC server is unavailable" and I don't have access to change permissions or services in that machine.
Does anyone have any other idea?