Question Comparing .txt files

jj24716

Distinguished
Dec 26, 2016
7
0
18,510
I have a bunch of files I would like to compare. I would like to see if file 1.txt has contents that is part of another .txt file.

But I need a program that will scan a bunch of files. All the file compare options I have seen only compare about 2 or 3 and you need to know which files to compare.

Thanks
 
I have a bunch of files I would like to compare. I would like to see if file 1.txt has contents that is part of another .txt file.

But I need a program that will scan a bunch of files. All the file compare options I have seen only compare about 2 or 3 and you need to know which files to compare.

Thanks
Possibly FreeFileSync?



I would like to see if file 1.txt has contents that is part of another .txt file.
That is MUCH more problematic.

The word "the" or the string "http" exists in thousands of my txt files. At what level do you spawn off "part of".
 
I would like to take 1 text file, have it compare a sentence or 2 and see if it exists in another .txt file without going through every file to see if it compares.
 
I would like to take 1 text file, have it compare a sentence or 2 and see if it exists in another .txt file without going through every file to see if it compares.
Actually, you can sort of do this directly in Windows File Explorer.

Search for your desired sentence, in a specified folder.
If required, put quotes at beginning and end.

I just tried this on a brand new .txt with a couple of words in it, saved on the Desktop
It was found quite quickly.
 
you can use the findstr.exe command to search files for particular strings

https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/findstr

it can search directories and subdirectories for a string and use wildcards to specify what file to search.
*.txt files to search all files with .txt extension.

you can also
-use a input file of the strings to search for.
- search subdirectories
- search binary files
- use a input file to select the files to search or use wild cards

this function can also search for binary patterns.
which makes it useful for finding pooltags hidden in device drivers for debugging purposes. (common problem for kernel memory leaks)
 
Last edited:
Also look into Powershell's Compare-Object cmdlet.

https://learn.microsoft.com/en-us/p...ll.utility/compare-object?view=powershell-7.5

There are many other similar links to be found.

Powershell is included with Windows.

You may also be able to apply other cmdlets (e.g.,, "Get-") and some scripts for even more precision and versatility.

Very customizable.

Start simple and go from there.

Just be sure to back up all important files first and to work in a test environment with file copies.