Home » Blog
date 21.Apr.2019

■ Search for missing files (negative search)


Usually you are searching to find an existing document, by Name or any other search criteria. Occasionally you need to test for absence, e.g. find folders that lack a type of file (e.g. a music folder where album art is missing). In the past I offered a WSH script approach, but it is possible to do a similar missing file test within xplorer².

A stock column called Contents [S] normally shows the number of files inside a folder. But I bet few of you know that this column is adjustable through the szFileCountRule registry tweak:

The global registry value szFileCountRule can be either a comma separated list of filename wildcards to match (default='*' to match and count all folder contents) or even the name of a previously saved complex filter

So if we set szFileCountRule = *.JPG,*.PNG (using Tools > Advanced options menu command) the Contents detail will return the number of JPG/PNG files in a folder instead of the total file count. We can then use this column to find folders that have no album art in them, i.e. folders where this count is 0.

If we don't want to tweak the registry each time we need a different wildcard for szFileCountRule, we set it once and for all to a saved filter name, then we alter the definition of the named filter, which is possible while xplorer² is running. This way we can use more complex criteria for the Content [S] column, not just filenames. Here's a demo video explaining the steps:

To recap, the steps for searching for missing files are:

  1. Use Tools > Advanced options to set szFileCountRule to a fixed name like cntRule (the exact name doesn't matter)

    you only have to do this step once


  2. Start a file search, and define the missing file search criteria for cntRule, e.g. a file wildcard. Store the rule using the Save button
  3. Search for folders whose Contents [S] column is 0 (absent files). Remember this implicitly uses your cntRule

Whenever you need to search for different missing files, just repeat the steps 1-2 defining a new search pattern for cntRule. Or if you want to restore the contents column to count all files, save cntTool to an all-inclusive wildcard like *.*

This solution isn't as thorough as the aforementioned WSH script as it won't check if the examined folder contains music file types, it just reports folders without pictures in them. But if you search within My Music folder, all subfolders will have MP3 files in them implicitly. It all depends on how your folders are organized and how do you define what's "missing". Just extrapolate for your needs!

Post a comment on this topic »

Share |

©2002-2019 ZABKAT LTD, all rights reserved | Privacy policy | Sitemap