Welcome to the Mythicsoft Q&A site for:

- Agent Ransack
- FileLocator Lite
- FileLocator Pro

Please feel free to ask any questions on these products or even answer other community member questions.

Useful Links:

- Contact Us
- Help Manuals
- Mythicsoft Home
0 votes

I need to do a search where I'm looking for the same result in multiple files. I only care about a search result if more than one file is found in the folder. e.g.

File name:       *.txt;*.csv
Containing Text: ver*120
Look in:         S:\Source Code

If both a text file and a CSV file in the SAME folder contain the text I would like the result returned.

by (715 points)

1 Answer

0 votes

Since each file is searched independently of the other you can't achieve the results in a single step. However, you could create an output transform that provides a list of folders with more than one file.

Save the following text to a file, e.g. folders_multiple_files.xsl

<?xml version="1.0"?>
<!-- Folders with more than one hit transform
    Copyright (C) Mythicsoft Ltd 2014. All rights reserved.

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:rslt="http://www.mythicsoft.com/FileLocator_16Aug2005" version="1.0">

  <xsl:output method="text" indent="yes"/>
  <xsl:key name="path-match" match="rslt:file" use="rslt:path" />
  <xsl:template match="/">
    <xsl:apply-templates select="//rslt:file"/>

  <xsl:template match="rslt:file">
    <xsl:if test="generate-id() = generate-id(key('path-match', rslt:path))">

      <xsl:if test="count( key('path-match', rslt:path) ) > 1">
        <xsl:value-of select="rslt:path"/>
        <xsl:text> files:</xsl:text>
        <xsl:value-of select="count( key('path-match', rslt:path) )"/>


Then after a search use that transform to list the folders of interest by exporting the results, e.g.

Export with transform

Which would produce output something like this:

S:\Source Code\Admin\UI files:4
S:\Source Code\Browser\List files:2
S:\Source Code\Docs files:10
by (31.4k points)