System.out.println("Host not found");
si.getServerConnection().logout();
return;
}
HostDatastoreBrowser hdb = host.getDatastoreBrowser();
System.out.println("print out the names of the datastores");
Datastore[] ds = hdb.getDatastores();
for(int i=0; ds!=null && i<ds.length; i++)
{
System.out.println("datastore["+i+"]:");
DatastoreInfo di = ds[i].getInfo();
System.out.println("Name:" + di.getName());
System.out.println("FreeSpace:" + di.getFreeSpace());
System.out.println("MaxFileSize:" + di.getMaxFileSize());
}
System.out.println("print out supported query types");
FileQuery[] fqs = hdb.getSupportedType();
for(int i=0; fqs!=null && i<fqs.length; i++)
{
System.out.println("FileQuery["+i+"]="
+ fqs[i].getClass().getName());
}
HostDatastoreBrowserSearchSpec hdbss =
new HostDatastoreBrowserSearchSpec();
hdbss.setQuery(new FileQuery[] { new VmDiskFileQuery()});
FileQueryFlags fqf = new FileQueryFlags();
fqf.setFileSize(true);
fqf.setModification(true);
hdbss.setDetails(fqf);
hdbss.setSearchCaseInsensitive(false);
hdbss.setMatchPattern(new String[] {"sdk*.*"});
Task task = hdb.searchDatastoreSubFolders_Task(
datastorePath, hdbss);
if(task.waitForMe()==Task.SUCCESS)
{
Object obj = task.getTaskInfo().getResult();
if(obj instanceof ArrayOfHostDatastoreBrowserSearchResults)