FileBadger by MollieSoft - Frequently Asked Questions
	- Updated April 27, 2020 for Version 1.1.2.0.

What is FileBadger?
	- FileBadger is a FREE utility from MollieSoft that performs fast file searches.
	- Find files in multiple folders on any disk or network share, using MollieSoft File Query Language (MFQL).
	- Specify multiple top-level search folders and include or exclude these as desired in any search.
	- Use Simple search (field controls) or use full-blown MFQL boolean queries; simple search just builds an appropriate MFQL query.
	- Use regular expressions for file/folder name matches (optional).
	- Help menus assist in building MFQL or regular expressions.
	- Easily save and reuse useful search queries.
	- Export search results to csv files for viewing in Excel.
	- Faster and more flexible than searching with Windows Explorer.

How do I install FileBadger?
	- Go to www.molliesoft.com/FileBadger to download the install package.  You will need administrator privileges on your machine to perform the install.

What operating systems will run FileBadger?
	- FileBadger runs on Windows 8.1 or Windows 10.
	- FileBadger requires the Microsoft .NET Framework version 4.6.1 to run.  This should normally already be present; if the FileBadger installation process detects it is not installed, go to
	https://www.microsoft.com/en-us/download/details.aspx?id=49981
and install it.

How do I run FileBadger?
	- The install process places a shortcut to FileBadger on your desktop.
	- Only one instance of FileBadger can be running at any given time.  If it is already running, invoking the FileBadger desktop shortcut will simply activate the running instance.

How can I learn more about how FileBadger works?
	- This FAQ is the main source of information about FileBadger.
	- Please email support@molliesoft.com with any questions that the documentation does not address.

Does FileBadger search within the contents of files?
	- No.  FileBadger does not examine file contents, but performs searches based only on file properties such as name, folder, size, date, etc.  FileBadger is a lightweight and responsive application and searching within files would slow it down significantly.
	- For the same reason, FileBadger does not examine file metadata, such as title, author, bit rate, etc.

Where does FileBadger search for files?
	- FileBadger uses a list of search folders that you specify.  You can add or remove folders to control which files are examined during search.
	- A search folder will only be examined during a search if the Included box is checked.  You can include or exclude any search folder (before a search).  You will see the same set of included folders when FileBadger is restarted.
	- Use the Add button to add a folder.  This can reside on a normal disk, a network share, or a removable USB drive (any addressable folder).  To add a folder, it must be available at that time; however during searches, any unavailable folder will just be skipped.  The history log reports folders that were skipped during a search.
	- Search folders can overlap.  For example, if you have added the folder "C:\MyStuff", you can also add "C:\MyStuff\Docs", and vice versa.  If both folders are included in a search, file results will be listed twice, once for each included folder.
	- Use the Remove button to remove a search folder from the list.
	- Each search folder is assigned a sequential number for identification.  When you perform a search, the folder number of the file is shown at the left of the file list.  Note if you hover the mouse on the folder number, you will see the actual search folder path in a tooltip.

What's the easiest way to find files with a particular name, date or size?
	- Check the Simple Search box and type some search terms (separated by spaces) in the "File name" text field, then press the Enter key or the green Search button.  This will find all files (in any included search folder) whose name (without the file folder) contains all of the search terms, and will display the matches in the Files list.  If you wish to search for a term that contains spaces, just surround the search term by double-quotation marks.
	- For example, type "birthday picture" in the File name text field (without the quotation marks) to search for files whose name contains both "birthday" and "picture".  Press the Enter key or use the green Search button to display all such files in the list below.
	- To search for files whose name contains the terms "birthday" OR "picture", click the "Match ANY word" checkbox, then press Search.  All files that contain EITHER "birthday" or "picture" will be displayed; of course this will be many more than before, when you were searching for "birthday" AND "picture".
	- Type "fiction" in the File folder text field to search for files whose relative folder contains "fiction".  Note that the file folder does NOT include the top-level search folder.
	- Normally, case (capitalization) is not considered when determining if a term occurs in the file or folder name.  To search in a case-sensitive manner instead, you can click the "Match case" checkbox.  Now files whose name contains "Birthday" will not match the term "birthday".
	- You can search for files with a specific range of last write times using the File last write time controls; click the checkbox in front of either date/time box to enable it, then select a date from the drop-down calendar, and enter a time.  If you select only a "from" time, you are searching for files with subsequent last write times; if you select only a "to" date, you are searching for files with previous last write times.  If you select both "to" and "from" times, you are searching for last write times between the "to" and "from" times.
	- You can search for files of a certain size using the File size controls.  Pick a unit to use for the size (B = bytes, KB = kilobytes, MB = megabytes, GB = gigabytes), then type a "from" size, a "to" size, or both in the number boxes.
	- When using Simple Search, the files found must satisfy all the criteria you specify; you can edit the search query and change some "and" words to "or" if you want the results to satisfy any of the criteria.
	- FileBadger will remember the last used settings in the Simple Search controls when restarted.
	- The status area at the bottom tells you how many files were found in the last search, or if an error was encountered; see the history log for more details.

What can I do with the file search results in Search View?
	- Sort any column in the files list by clicking the column header.  Click again to sort the column in the opposite direction.
	- Select a file, then use the "Explore" button to open a Windows explorer positioned at the selected file.  If the disk or network share containing the file is not available, you will be prompted to mount it.
	- Use the "Export" button to export the file list to a comma-separated-values file, which you can then view using e.g. Microsoft Excel.
	- Use the "Maximize" button to make the file list fill the entire window for easier viewing of large lists.  Once maximized, use the "Restore" button to move the file list back to its original position.

What does the "Simple search" checkbox do?
	- When it is checked, you are building a search query from the "Simple Search" field controls, instead of building a query by typing directly in the "Search query" text box.
	- When Simple Search is checked and you change the Simple Search field controls, then press the green Search button, you will see the resulting search query expression in the "Search query" text area.  Every file in every included search folder is then evaluated against this search query, and files that satisfy the query appear in the files list.
	- Building a query in this way (using the controls) is a Simple search.  However, you can enter any legal search query in the "Search query" text area, then press the green Search button (or use the shortcut key combination Control-Enter) to get the corresponding files results.  When you search in this more complex way, the check mark is removed from the "Simple search" checkbox to indicate you are using a "raw" search expression instead of building it from the controls.  If you manually check the "Simple search" box, the green Search button will once again use the field controls to build a query.

When should I just use general MFQL search queries directly?
	- Use MFQL to include or exclude files based on more complex criteria than is available in Simple Search.
	- Use MFQL for search variables other than just $fileName, $fileFolder, $fileLastWriteTime, or $fileSize.
	- Use MFQL for comparison operators other than the ones used in Simple Search, e.g. regexMatch, startsWith/endsWith.
	- Use MFQL for complex date/time or size expressions.

What is the language used by search queries?

	- Search queries are written in MFQL (MollieSoft File Query Language), described below.

	- A basic query (also called a statement) compares a file variable with a constant.  (The value of a "constant" is independent of the file being considered.)
 Here are some examples:
•	[$filePath has "birthday"] looks for files whose full path has the text "birthday" in it.  (Note $filePath does not include the search folder prefix.)
•	[$fileLastWriteTime > $now - $days.2] looks for files modified less than 2 days ago.
•	[$fileName has "picture"] looks for files whose name (not including the folder) contains the text "picture".
•	[$fileFolder startsWith "fiction"] looks for files whose relative folder (not including the search folder prefix) starts with the text "fiction".
•	[$fileSize > $MB.100] looks for files whose size is greater than 100 megabytes.

	- Basic queries are always surrounded by square brackets.

	- Basic queries can be combined using any combination of the logical operators 			AND, OR, NOT, and parentheses ( )
to form a complex query.  For example, the complex query
		[$fileCreationTime < $datetime.20150501]
			and not [$fileFolder has "Document"]
looks for files created before May 1, 2015 but whose relative folder does not contain the text "Document".  Remember, upper/lower case is only considered if Match case is checked.

	- Note that when you use "Simple search" (build a query using the field controls) the basic queries are always combined using the AND operator.  However, if "Match ANY word" is checked, multiple text fields within the File name or File folder will be combined using the OR operator.

	- File variables are of two types: text variables and arithmetic variables.  Text variables can only be compared with text values, and arithmetic variables can only be compared with arithmetic values.

	- Text variables can be compared with text constants using the operators:
		= ,  != ,   "has", "startsWith", "endsWith", "regexMatch".
•	The equal and not-equal operators test for equality and inequality.
•	The "has" operator tests whether the second operand is present in the text value of the first operand.
•	 "startsWith" tests whether the first operand begins with the second operand.
•	"endsWith" tests whether the first operand ends with the second operand.
•	"regexMatch" matches the text variable with a regular expression.

	- For example, say the file has the name "MyTodoList.txt".  Then all these statements are true:
		[$fileName = "MyTodoList.txt"]
		[$fileName  != "MyTodoList"]
		[$fileName has "List"]
		[$fileName has "TodoList"]
		[$filename startsWith "MyTodo"]
		[$filename endsWith "List.txt"]
		[$fileName regexMatch "^[MN]yTodoList.txt$"]
But these are false (note spaces within text constants are important):
		[$fileName has "List  "]
		[$fileName startsWith "Todo"]
		[$fileName endsWith "List"]

	- Operator names are case-insensitive: "has" is the same as "Has", "startsWith" is the same as "startswith", "EndsWith" is the same as "endsWith", "RegexMATCH" is the same as "regexmatch".

	- Arithmetic variables can be compared with arithmetic expressions using the operators:	=,  !=,  <,   >.

	- Variable names are always case-insensitive.  Thus, the forms $fileSize and $filesize are both valid.

	- The text variable names (text property of files) used in MFQL are:
•	$fileName - the name of the file, without directory (folder).
•	$fileFolder - the relative folder of the file, omitting the file name and the search folder prefix.
•	$filePath - the full path of the file (including the file folder but omitting the search folder).
•	$fileExtension - the extension of the file (e.g. ".mp3"), including the leading period.
•	$fileAttributes - the file attributes, consisting of letter codes:
R = Read only
H = Hidden
S = System
D = Directory
A = Archived
T = Temporary
P = Sparse file
C = Compressed
E = Encrypted
I = NotContentIndexed
For example, a particular file may have $fileAttributes = "HSA"; the letter codes for the attributes are just strung together.  Thus, you could search for [$fileAttributes has "RH"] to find all read-only hidden files.

	- You can also query the string length (number of characters) of any text variable by appending ".Length" to the variable name.  For example, the query
		[$fileName.Length > 25]
searches for files whose name has more than 25 characters.

	- The arithmetic variable names (arithmetic property of files) used in MFQL are:
•	$fileLastWriteTime - the date/time the file was last written to (modified).
•	$fileLastAccessTime - the date/time the file was last read or written.
•	$fileCreationTime - the date/time the file was created.
•	$fileSize - the size of the file in bytes; can be compared with a $kb or $mb or $gb value.  For example [$fileSize > $gb.8] looks for files more than 8 GB in size.
(Note that each of the file time variables are in local time, not UTC.)

	- Some arithmetic variables are used as convenient expressions for arithmetic constants.  These have the form:
•	$now - the current date/time.
•	$datetime.YYYYMMDD_hhmmss - where YYYY is the year, MM the month, DD the day, hh the hour, mm the minute, ss the second; leading zeros are required.  The reduced form $datetime.YYYYMMDD is also valid and represents midnight (start of the day).
•	$days.N - where N is the number of days (N >= 1); can be added to or subtracted from a date/time.
•	$timespan - can be any of the forms:
		$timespan.ss
		$timespan.mmss
		$timespan.hhmmss
		$timespan.d.hhmmss
   where ss = seconds, mm = minutes, hh = hours, d = days; can be added to or subtracted from a date/time.  Leading zeros for hh, mm, ss are required in each form.
•	$kb.N - where N is the number of kilobytes.
•	$mb.N - where N is the number of megabytes.
•	$gb.N - where N is the number of gigabytes.

	- For example:
•	$datetime.20170823_193033 - represents the date/time August 23, 2017, 7:30:33 p.m.
•	$days.23 - represents a time span of 23 days.  This can be added to or subtracted from a $datetime value.
•	$kb.40000 - represents 40000 kilobytes.
•	$mb.50 - represents 50 megabytes.

	- Here are some examples of complex expressions:
•	Find files created less than a week ago, greater than 20 MB in size:
	[$fileCreationTime >$now - $days.7] 
		and [$fileSize > $MB.20]
•	Find files whose name contains "document", between 5 and 10 MB in size, last modified on August 23, 2017 (note the expression $datetime.20170823 represents midnight on that day):
	([$fileName has "document"])
		 and [$fileSize > $MB.5] and [$fileSize < $MB.10]
		 and [$fileLastWriteTime > $datetime.20170823] 
			and [$fileLastWriteTime < $datetime.20170824]
	
It's hard to remember all these variable and constant names!  Isn't there an easy way to add the correct form of a file variable or constant into the search query text area?
	- Yes.  Use the "Insert Search Term" button above the search query text area to show the query helper menu.  Select a variable, operator, or constant from the menu, and it will be added into the text box at the current position to form a statement, then connect your statements with the logical operators and/or/not to make complex queries.
	- You can also show the query helper menu by right-clicking in the search query text area.
	- You can also press the Help button at the top to show the Search Help window.  This provides a convenient summary of search query syntax that you can use while composing queries.  Note: press Ctrl-F in the Search Help window to show the Find Bar and find text within the document.

How can I use regular expressions in the search?
	- Warning!  Regular expressions are rather complicated and are intended for the "power user".  If you don't feel comfortable with them, just ignore this capability and use the plain text search operators "=", "!=", "has", "startsWith", "endsWith".
	- Example: to search for files whose name starts with 2 numeric digits, use the query [$fileName regexMatch "^\d\d"].
	- When building a search query, you can use the "regexMatch" operator with any text variable, such as $fileName or $fileFolder.  This will perform the match using the Microsoft version of regular expressions, explained at https://docs.microsoft.com/en-us/dotnet/standard/base-types/regular-expression-language-quick-reference.  You may also like the "cheat sheet" available at https://download.microsoft.com/download/D/2/4/D240EBF6-A9BA-4E4F-A63F-AEB6DA0B921C/Regular%20expressions%20quick%20reference.docx 
for quick reference.
	- Here are some examples of regular expression syntax.  These snippets are also available using the "regex builder" button  above the Search query text box.
. 			- Match any single character
.* 			- Match any character zero or more times
.+ 			- Match any character one or more times
[abc]			- Match any character in the set 'abc'
[^abc] 		- Match any character NOT in the set 'abc'
[a-f] 			- Match any character in the range a to f
\d 			- Match any numeric character
? 			- Match preceding character zero or one times
* 			- Match preceding character zero or more times
+ 			- Match preceding character one or more times
\d{3} 			- Match three consecutive decimal digits
0[xX][0-9a-fA-F]+	- Match a hexadecimal number
[0-9]*\.*[0-9]+ 	- Match integers and decimals
^ 			- Match beginning of text
$ 			- Match end of text
You can select any of these entries from the regex builder dropdown menu, which will insert the selected expression into the search query text box at the cursor.  You can then modify the inserted expression as desired.

How can I save a query once I have built one I want to keep?  How do I reload it?
	- The "File Menu" button above the "Search query" text box shows a drop-down menu with a "Save as..." menu item, which brings up a "Save Search Query File" dialog.  This lets you save a query to disk as a small text file in the queries directory
%localappdata%\FileBadger\Queries, with the extension ".qry".  Enter a valid file name for the query, then press OK.  (Note: "%localappdata%" is a Windows shortcut that resolves to the local application data directory for the current logged-on user.)
	- To reload a saved query, use the "File Menu" button again, and select the menu item "Load...".  This shows a "Load Search Query File" dialog allowing you to select any previously created .qry file from the queries directory.  Select a query from this dialog to paste it into the "Search query" text box, then press the green Search button to actually run the query.
	- If you have saved a query to a file as above, you can rename it using the "Rename" menu item.  Enter a new name for the query in the "Rename Query" dialog that appears, then press OK.
	- When the cursor is in the "Search query" text area, you can use the keyboard shortcut Control-S to save a modified query.  This will either just save the query, or bring up the "Save as..." dialog as appropriate.
	- You can remove a query file using the "Remove" menu item.  Predefined queries (see below) cannot be removed.

Why are some query names surrounded by angle brackets, e.g. <Large files> in the "Query name" dropdown list?
	- There are several useful predefined queries provided in the "Query name" dropdown list; these also serve to demonstrate query syntax. Angle brackets around the query name are used to distinguish the predefined search queries from the search queries that you create.  These include (among others):
•	<Large files> - search for files with size > 10 megabytes.
•	<Files modified this week> - search for files last written to in the last 7 days.
	- You can use these as written, or modify them to make your own queries.
	- Modified predefined queries cannot be saved as such; if you change a predefined query, select "Save as..." in the File Menu to save it to disk with a new name.
	- If you do not want to see the predefined queries in the list, open the FileBadger Settings dialog and turn off "Show sample queries".

Once I have some search results, how can I navigate to a specific file?
	- Use fast keyboard search:   If you click on a line in the ""File folder" or "File name" column of the results list, you can navigate to items by simply typing a sequence of characters to locate within the text of that column.  This will just move the highlight in the list to the next matching entry.  You can also press Alt, along with one of the up/down arrow keys, to find the next or previous matching entry in the column.  The status line at the bottom shows you the current search string.  Keyboard search is cancelled if no key has been pressed within 10 seconds, or if you press the escape key, or if you move to a different column.
	- In this text search mode, you are just searching for file names or folder names containing the text you have typed.  The search is case-insensitive.  No special characters are used or recognized, so e.g. searching for "*.txt" will never match anything since "*" will not actually occur in any file or folder name.

Splash Screen

What does the splash screen show?
	- The current FileBadger version number.
	- Validity check for the FileBadger (free) license.
	- The total elapsed time for initialization of the program.

The splash screen is annoying!  Can I turn it off?
	- MollieSoft is deeply sorry that you do not appreciate our beautiful splash screen!  However, to mollify the occasional customer with a distaste for splash screens, we have provided a check box in the "Settings" dialog that you can use to turn off the splash screen.

Miscellaneous

Can I disable the little yellow tooltip pop-up windows that appear over controls?
	- Yes; just uncheck "Enable Tooltips" in the Settings dialog.

Can I disable the sound played when a search is completed?
	- Yes; just uncheck "Enable Sounds" in the Settings dialog.

The text in FileBadger is too small for me to read comfortably; is there a way to make it bigger?
	- Yes; press the key combination Control+Numpad-PLUS to step the font size up, and Control+Numpad-MINUS to step it back down.  That is, hold down the Control key while pressing "+" or "-" on the numeric keypad.  (Note this does not work while a dialog is open.)
	- There are four step sizes: small, medium, large, and extra large.  These correspond to the Windows font point sizes 8.25, 9, 9.75, and 10.25 respectively.
	- Of course, increasing the font size will make all the views and dialogs correspondingly larger, and decreasing it will make them smaller.
	- The new font size will be remembered whenever you re-open a view or dialog, or restart FileBadger.
	- You can also set the font size using the Settings dialog.  Select the appropriate font-size radio button (small, medium, large, extra large); the new font size will be applied once you press OK.

What is the History Log?
	- Every time FileBadger is started, a new History Log file is created in the directory 
		%localappdata%\FileBadger\Logs.
(Just paste this into a Windows Explorer navigation bar to display the contents of this directory, or press the button "Explore Logs" on the History Log window.)  The files are named using the format
		 FileBadgerLog.YYYYMMDD_hhmmss.log,
e.g. FileBadgerLog.20200102_143932.log is the file created when FileBadger was started on 2020/01/02 at 14:39:32.  These files contain diagnostic information relevant to the operation of FileBadger, and can be opened using Notepad.
	- To see what is being written to the History Log in real time, click the History Log button at the top of the FileBadger main window to open the History Log window.
	- At startup, the History Log will display the current FileBadger version and (free) license information.
	- The History Log contains a record of FileBadger searches and any errors encountered.
	- The "Explore Logs" button at the top right of History Log will open a Windows Explorer, and show you the logs directory containing the history log files for all past executions of FileBadger.

What else is in %localappdata%\FileBadger?
	- Warning!  Never modify any file in this directory or any subdirectory, or the results will be "unpredictable".
	- This directory contains your (free) license information.
	- The "Config" subdirectory contains timestamped FileBadger.cfg files, which hold various FileBadger program settings, and information about your search folders and preferences.
	- The "Logs" subdirectory contains FileBadger log files (the current log file is shown in the History Log window).
	- The "Queries" subdirectory contains any custom search queries you have saved.

Where do I send comments or suggestions about FileBadger?
	- Email comments or suggestions to:
		support@molliesoft.com
	 or to
		molliesoft@comcast.net