Fast search within files in Windows
File search is commonly used in automation. But when the file number within the folder is too big the standard search method take very long to complete. A solution to that problem is to use a Windows Search feature.
Windows Search builds a full-text index of files on a computer. Once a file is indexed we can use the index to search results more rapidly than it would take to search through all the files on the computer. Searches are performed on file names, contents of the files, folders, mails and other media on local or remote machines.
We have to know that not all files in Windows are indexed. Indexed folders can be found in Indexing Options. This is the location where we can add other folders to the index.
In order to search remote location we have to ensure the searched location (folder) is added to the index on the target machine.
Example Windows Search queries:
Search files by file names:
SELECT System.ItemName FROM SystemIndex WHERE System.ItemName LIKE '%name%'
Search files by name in folder C:\temp and sub-folders
SELECT System.ItemName FROM SystemIndex WHERE scope ='file:C:/temp' AND System.ItemName LIKE '%name%'
Search files in the folder C:\temp only
SELECT System.ItemName FROM SystemIndex WHERE directory = 'file:C:/temp' AND System.ItemName LIKE '%name%'
Search folder by name
SELECT System.ItemName FROM SystemIndex WHERE System.ItemType = 'Directory' AND System.Itemname LIKE '%name%'
Search remote location
SELECT <columns> FROM [machinename.]SystemIndex [WHERE <conditions>]
Columns of the index :
System.Author | System.Document.CharacterCount |
System.Category | System.Document.ClientID |
System.Comment | System.Document.Contributor |
System.Company | System.Document.DateCreated |
System.ComputerName | System.Document.DatePrinted |
System.ContentStatus | System.Document.DateSaved |
System.ContentType | System.Document.Division |
System.Copyright | System.Document.DocumentID |
System.DateAccessed | System.Document.HiddenSlideCount |
System.DateAcquired | System.Document.LastAuthor |
System.DateArchived | System.Document.LineCount |
System.DateCompleted | System.Document.Manager |
System.DateCreated | System.Document.PageCount |
System.DateImported | System.Document.ParagraphCount |
System.DateModified | System.Document.PresentationFormat |
System.DueDate | System.Document.RevisionNumber |
System.EndDate | System.Document.SlideCount |
System.FileAttributes | System.Document.TotalEditingTime |
System.FileDescription | System.Document.WordCount |
System.FileExtension | System.Document.ByteCount |
System.FileName | System.Document.CharacterCount |
System.FileOwner | System.Document.ClientID |
System.ItemAuthors | System.Document.Contributor |
System.ItemDate | System.Document.DateCreated |
System.ItemFolderNameDisplay | System.Document.DatePrinted |
System.ItemFolderPathDisplay | System.Document.DateSaved |
System.ItemFolderPathDisplayNarrow | System.Document.Division |
System.ItemName | System.Document.DocumentID |
System.ItemNameDisplay | System.Document.HiddenSlideCount |
System.ItemNamePrefix | System.Document.LastAuthor |
System.ItemParticipants | System.Document.LineCount |
System.ItemPathDisplay | System.Document.Manager |
System.ItemPathDisplayNarrow | System.Document.PageCount |
System.ItemType | System.Document.ParagraphCount |
System.ItemTypeText | System.Document.PresentationFormat |
System.ItemUrl | System.Document.RevisionNumber |
System.Keywords | System.Document.SlideCount |
System.Kind | System.Document.TotalEditingTime |
System.SourceItem | System.Document.WordCount |
System.StartDate | System.Search.AutoSummary |
System.Status | System.Search.Contents |
System.Subject | System.Search.EntryID |
System.ThumbnailCacheId | System.Search.GatherTime |
System.Title | System.Search.Rank |
System.Document.ByteCount | System.Search.Store |
To simplify using Windows Search we have created a Blue Prism VBO that can be downloaded here.
Recent Comments