Dfind
Programmers fast text
search tool
- Dfind
-
- Programmers fast text search tool
- Features:
- Simple Search
- Looking at results
- Viewing options and how to set
- Other Miscellaneous options
- Search History
- Miscellaneous features
- Advanced Search using Multiple
Folders, Multiple Filespecs, and Multiple Strings
- Search/Replace
- Example using Search/Replace
- Search/Replace Backup files
- Archive example
Download Info
Current Version V7.24.9.6
32 Bit Version DFind.exe
64 bit Version DFind64.exe
(Info - No installer, writes only to its own ini file, or a text file if
text/print output selected)
Features:
- Fast (optimised)
- Can search files not available otherwise - eg Delphi can search
project and Form files for wanted text
- Several ways to view the text and files found
- Can search filenames as well
- Can search within results also
- Search multiple folders - standard sets can be used
- Google type find option - can find several words which can be in any
order in a line but all have to be present
- Search Multiple folders
- Search Multiple Filespecs
- Search Multiple strings
- Searching every Filespec skips binary files/in use files/non text
files
- Search/Replace function
- Search/Replace multiple strings
- Searches Ansi or Unicode text files (most programming files, SQL
scripts, VS Files etc are Ansi text unless special characters are
used). A 64 bit version that does Unicode files is available
- called DFind64.
- Search huge folders efficiently, with progress display
- Capture found text results as text file or export to spreadsheet
Simple Search
Simple and quick search of one folder, 1 filespec, for one string is set
up to be really easy to do.
Folders - The Current button selects the current folder, the Browse
button allows you to choose a folder
Enter or choose a folder
Enter a Filespec such as *.txt or DF*.pas, or *.* to search
everything
Enter a string to search for in the files
Click the Search button
Look at the results (Shows line numbers and the lines matching in all the
files searched)
Note! you can safely search all files in a folder using *.*, DFind will
skip any files that it cannot open, binary files, files that take too long
to open, files locked because they are in-use, and any files that are not
text.
The main benefit of searching a Filespec such as *.pas is to reduce the
number of files and time taken for a search.
How fast is DFind?
Here are typical times taken for searches - this is on a typical PC, note
I have seen faster times on some networks
The speed is quite well optimised as:
- It uses the Windows low level API to scan folders (FindFirst and
FindNext) - it does not use huge resources to scan folders.
- I am using a customised component that does the Folder, Filespec and
date selections as it scans the filesystem
- As a result the list of files to search for text is already filtered
to only those wanted.
- You will find that often the second and subsequent searches are often
much faster as Windows has then cached the files.
I have also noticed the 64 bit version of DFind is often faster.
Looking at results
You can search for any text within results using CTRL+F and
F3 for Find Next
In the results, CTRL+N jumps to the next file, CTRL+P to the
previous file
You can view a window of 10 lines around the highlighted line. Press
CTRL+W to toggle this window on and off
You can view the entire file of the highlighted line. Press
CTRL+V to toggle this window on and off
(This shows part of the file viewer on the right over the results
window on the left. Normally the file viewer will fill the whole
screen).
You can Double-click any line of the file and depending on what is
set as the Viewer for that file it will open with this.
Viewing options and how to
set
If there is no action defined for this file type, the program will
ask how to open the file
Possible options you can set up for any file extension/file type
are:
ASK Asks how to open the file
WINDOWS using the windows default program to open the file
VIEWER uses the built in file viewer
Notepad
Notepad++ and EditPlus can also be used if installed - you need to
set where installed to and the advantage of these programs is they will
position the cursor at the exact part of the file
These can be set in the ini file - for example:
[Viewer]
TXT=Notepad
BAT=E:\JBData\Programs\EditPlus5\Editplus.exe
XML=E:\Utilities\Programs\Notepad++.exe
PAS=E:\JBData\Programs\EditPlus5\Editplus.exe
BAK=ASK
LST=Viewer
LOG=Viewer
Other Miscellaneous
options
Most of these are fairly obvious:
- Omit binary files etc will skip any file with extensions like .exe,
and any files that are not text.
- Also skipped are .bak and Dfind SearchReplace archive logs.
- Hidden sub-folders are also skipped with this option. Commonly
SVN and Delphi history folders are hidden
- Faster turns off the display of results while searching - this makes
a huge difference so recommend leaving this set - you see a progress
display of a counter plus the current folder.
- Google type find is a multi-word search: e.g. If you have 4 words in
the string to search, then matching lines have to include all four words
in any order.
e.g. to use enter 4 words in the string edit box and tick Google type
find. (Note - applies to simple strings searches only)
Date Options:
This allows to search for files modified only in a date time range.
(e.g. search files in a folder with a huge number of files but only want
to search today's files)
View Options:
Use Courier (Non-proportional) font for View Windows (CTRL+V) - this
option can work better if you are viewing a text file with columns of data
Search History
- For a simple string search, each individual string searched for in a
session is saved into a history
- you can choose it again from the history.
Miscellaneous features
- Top right are 3 useful buttons
- a up and down arrow sets button the window to use the whole screen
vertically
- a summary of tips
- a summary of the advanced search options
- If you have longer lines you can stretch the window wider
- If you alter the search string or folders or filespecs, the previous
search counts will turn grey to show they are not for the current search
parameters
- There is a stop button while the search is underway - hitting that
will show the results found so far.
- The "Faster" option turns off displaying the results until the search
is complete or stopped. This speeds the search a lot.
(You see counts each second only while running)
Advanced Search using
Multiple Folders, Multiple Filespecs, and Multiple Strings
This is the real strength of DFind - you may want to search more than one
thing at once!
Advanced Folders - gives option of searching up to 10 different folders
Advanced Filespec - gives option of searching up to 10 different
filespecs - e.g. *.pas, *.dfm, *.dpr, *.sql
Advanced Strings - gives option of search for up to 200 strings
Each of these options can be turned on and off individually by clicking
the button to the right (grey=Off green=On)
With each of these Advanced options, if turned on you can enter a list.
The selection for these shows when you click in the entry field - e.g. for
Folders:
For Advanced Filespec:
For Advanced Strings:
Any lines with matches to any of these strings will be shown.
Tip: If for example you are dealing with source files that might
have varying formatting or spacing, e.g. some files may have A:=B
and some may have A := B (i.e. with spaces)
Then you can search for both:
A:=B;
A := B;
Note DFind does not yet have a regular search pattern facility (yet), in
the meantime multiple strings search is a good alternative.
Search/Replace
- You can search and replace one string with another
- There are options whether match has to be whole word or not, and
whether case sensitive
- Each time you select the Replace option you have to check the Replace
option - this is to prevent running it by accident.
- There is an option whether to approve each changed line in a file -
i.e. you can accept some changed lines and reject others
- The altered lines are shown before saving, and you can use a
difference program (such as WinMerge or Beyond Compare) to check if the
changes are OK.
- You can search and replace multiple strings as well (this option is
new with V6).
- If you use the Replace function you should install a Differences
Viewer such as WinMerge, Beyond Compare (etc) and set this in the Setups
- Example: DifferencesViewer=D:\Utilities\WinMerge\WinmergeU.exe
- This will show differences between original file and altered file
before saving/overwriting the original.
- Note any files with the text DfindSearchReplace in the filename can be
searched, but are skipped for Replace operations.
- This is to avoid Dfind temporary replace files and logs being
altered!
- You can create a list of strings to load from a file, each line has
the old text and the new text separated by a TAB character.
- Example of 3 lines in a file:
- oldword1<TAB>newword1
- oldword2<TAB>newword2
- oldword3<TAB>newword3
- The maximum number of multiple strings is 200 at present.
- If you create a list of strings to load from a file, call it something
like "ListOfStrings1-DfindSearchReplace.txt" so it will not be altered
with Search and Replace - any filename with DfindSearchReplace in the
filename is skipped.
- Make note of the backup files and change log made when files are
altered
- This is a new feature and because it can change files -
use with great care and keep backups.
Example using Search/Replace
1 - Set up the folder and Filespec to search
2 - Make a file with the old and new strings in it and save it with a
name like Test1-DfindSearchReplace.txt
Contents like (the separator between the columns is a TAB character):
(The first part of the line before the tab is the old text to find, and
the second part after the tab is the replace text)
minim crochet
tempo tempura
error woopsie
aliquid asolid
sed awk
officia bureaucratic
3 -Load this file into the Selection screen
Click the Replace button at the bottom of the page.
Examples of Search/Replace running, with query about replacing a line.
Note at this stage it has loaded the entire file and the display shows all
the matches, and it the option to approve
each line is selected it will now go through all the matched lines for the
file.
You have the option to approve or not one line change, or yes or not to
the remaining lines in the file.
When changes are completed for a file, the screen below is seen - this
shows the changed lines for the file.
Before you decide to save the file or not, it is strongly recommended you
use the Show Differences option:
(Note this test example has a very dense number of changes to show you it
can handle it)
This provides a cross check that the changes will be as you
expect. Note you can do this check before you elect to
overwrite the original file with the changes.
Search/Replace Backup files
There are several ways that Search/Replace changes are tracked
- Any file replaced (e.g. called file1.txt) has a backup file with name
like file1-DfindSearchReplace-20180826-093500-bak.txt (The
numbers are the date and time the file was replaced)
- Changes made are logged into a log file with name
DfindSearchReplace.log. This file is in the folder that the
searches start from. This log file shows details just of
which lines were changed.
- Dfind will not search or replace text in files that have
-DfindSearchReplace- in the filename!
- Any files replaced are archived in original form into an archive file
in the same folder as the program - called
DfindSearchReplaceArchive.jarc. This file is a text
archive of each original file with headers at the stop and end of each
file with information on the file name, date and time, and size etc.
- This archive can be used to recover files if needed by opening in an
editor, searching for the filename and copying and pasting the file
contents if required.
- There may be several changed versions of any one file in the archive,
so you will want to check the headers and date and time to get the
version you want.
Archive example
-<<<< Dfind Archive
>>>>-
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><1
Archived:26-Aug-18 ~ 19:06:47 ~ Lines=506 ~ Size=21663 ~
E:\JBData\Test Long with Spaces\Replace2.txt ~ Changes=3 ~ 17-Apr-18
13:07
size=21663<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><2
(complete file contents of
Replace2.txt before changes are here)
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><3
Archived:26-Aug-18 ~ 19:06:47 ~ Lines=506 ~ Size=21663 ~
E:\JBData\Test Long with Spaces\Replace2.txt ~ Changes=3 ~ 17-Apr-18
13:07 size=21663
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><4
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><1
Archived:26-Aug-18 ~ 19:12:55 ~ Lines=490 ~ Size=20170 ~
E:\JBData\Test Long with Spaces\Replace3.txt ~ Changes=7 ~ 18-Apr-18
12:07 size=20170
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><2
(complete file contents of
Replace3.txt before changes are here)
This Header information repeats at the beginning and end of the file -
followed by the next file archived