I have been tasked with managing a file crawler.

In effort of being as efficient/lazy as possible, I am trying to use Windows Search as the actual crawler and then just quering the data out of it.

Using some working SQL DB code, I have managed to get it to query the search index.

 Code:

	$cn = CreateObject("ADODB.Connection") $cmd = CreateObject("ADODB.Command") $rs = CreateObject("ADODB.RecordSet")
	$cn.connectionstring = "Provider=Search.CollatorDSO;Extended Properties='Application=Windows';"
	$cn.open
		$cmd.activeconnection = $cn	$rs.cursortype = 3	$rs.locktype = 3	$rs.activecommand = $cmd
		$cmdtxt = "SELECT System.ItemFolderPathDisplay, System.ItemName, System.ItemTypeText, System.Size FROM SystemIndex WHERE SCOPE='file:c:\'"
		$cmd.commandtext = $cmdtxt
		$rs.open($cmd)	
			$rs.MoveFirst
			While Not $rs.eof
				? $rs.fields.item("System.ItemFolderPathDisplay").value 
				? $rs.fields.item("System.ItemName").value 
				? $rs.fields.item("System.ItemTypeText").value
				? $rs.fields.item("System.Size").value
				?
				$rs.moveNext
			Loop
		$rs.close
	$cn.close


Much of the details are found here: http://msdn.microsoft.com/en-us/library/bb419046(VS.85).aspx
http://code.msdn.microsoft.com/windowssearch

I guess what I need is:
How do I search for a specific filename or extention (*.doc, or *.xls)
How do I add a filetype to the index (if I wanted it to index a custom file type)
_________________________
How to ask questions the smart way <-----------> Before you ask