Hi,
the VcHostDatastoreBrowserSearchSpec scriptable object has an attribut "matchPattern", see: https://www.vmware.com/support/orchestrator/doc/vco_vsphere55_api/html/VcHostDatastoreBrowserSearchSpec.html
Where can I apply this attribute, if I want to look for a specific folder on the datastore or look for a pattern in the file name? Or do I have to parse the actions output (string array) to filter out the values I need?
Here's the code, sorry for not formatting it properly, but I somehow can't access the advanced formatting options:
input: datastore and matchPattern (string)
-START-
var result = new Array();
var fileQuery = new Array(new VcIsoImageFileQuery());
var querySpec = new VcHostDatastoreBrowserSearchSpec();
querySpec.query = fileQuery;
var task = datastore.browser.searchDatastoreSubFolders_Task("[" + datastore.name + "]", querySpec);
var searchResults = System.getModule("com.vmware.library.vc.basic").vim3WaitTaskEnd(task,false,5);
for (var i in searchResults) {
for (var j in searchResults[i].file) {
result.push(searchResults[i].folderPath + searchResults[i].file[j].path);
}
}
for each (var output in result) {
System.log(output);
}
return result;
-END-