Compare two directories recursively, except for \bin\ and \obj\
Solution 1
Include and exclude refer to what is shown in the list of files and folders after the comparison is made. The filters are including and excluding things from that list.
If you use an exclude filter, it excludes, from the file listing, everything not listed in the filter.
If you use an include filter, it includes, in the file listing, everything not listed in the filter.
In your case, you are using an exclude, so you are only going to see the files and folders that you specifically list in your filter. To block bin
and obj
folders, you would need to know the names of all of the other folders you might want to see, so they can be listed in your filter.
I find, for code, it's easier to use an include filter. That way, I can block out folders and files that I don't care about.
Change the first def:
to be include
, and remove the second def
. I think you can only have one def
. Your d:
rules would then be
d: \\bin$
d: \\obj$
Solution 2
As others have mentioned, you can only have one def:
line, and the filters actually peform the opposite action of the def:
directive (ie when def
is exclude
filters actually include files).
So, with that knowledge, we can see that the following line is including all sub-directories.
d: \\*$ ## Subdirectories
I don't have WinMerge installed, and I'm not familiar with the RegEx engine in it, but you could try using a negative lookup to include all sub-directories except "bin" and "obj":
d: ^\\((?!bin|obj)(.+)|(.+)(?<!bin|obj))$
Solution 3
I had some limited success with @heavyd's answer, but later found this is much easier in WinMerge's apparent successor WinMerge2011.
With WinMerge2011 I used
xd: \\bin(\\.+|)$
xd: \\obj\\
It can be differcult to find documentation, but I found http://forums.winmerge.org/viewtopic.php?f=4&t=1010
File/directory filters have been enhanced in WinMerge 2011 to allow for combining both inclusion and exclusion rules. Omitting the def: label in an .flt file makes f: and d: operate as inclusion rules unless prefixed with x, in which case they operate as exclusion rules. The f: and d: labels, again optionally prefixed with x to form an exclusion rule, can also be used with wildcard filters.
FYI WinMerge appears to no longer being developed. See overview notes in https://en.wikipedia.org/wiki/WinMerge. Download WinMerge2011 at https://bitbucket.org/jtuc/winmerge2011/downloads/
Related videos on Youtube
![sab669](https://i.stack.imgur.com/YXOz8.png?s=256&g=1)
Comments
-
sab669 almost 2 years
I'm trying to use WinMerge to compare two directories:
C:\Users...\Desktop\Compare\35_A
C:\Users...\Desktop\Compare\35_HS
## This is a directory/file filter for WinMerge ## This filter lets through only files ASP.NET developers care about name: ASP.NET Devel desc: Lets through only files ASP.NET developer cares about ## This is an exclusive filter ## (it lets through only matching files) def: exclude ## Filters for filenames begin with f: ## Filters for directories begin with d: ## (Inline comments begin with " ##" and extend to the end of the line) f: \.xml$ f: \.xlst$ f: \.xsl$ f: \.xslt$ f: \.dtd$ f: \.html$ f: \.htm$ f: \.css$ f: \.gif$ f: \.bmp$ f: \.jpg$ f: \.png$ f: \.js$ f: \.dll$ f: \.aspx$ f: \.asmx$ f: \.ascx$ f: \.vb$ f: \.resx$ f: \.cs$ f: \.js$ f: \.vbproj$ f: \.csproj$ f: \.sln$ f: \.webinfo$ f: \.config$ d: \\*$ ## Subdirectories def: exclude d: \\bin d: \\obj
The last 3 lines aren't part of the filter, I added those as I'm trying to ignore anything and everything in all \bin\ and \obj\ directories. I've tried both
def: include
anddef: exclude
, neither provides accurate results.I've looked over the Help Documentation in WinMerge about the File Filters but I don't understand it.
-
sab669 almost 9 yearsI would need to go and add an untold number of filters for all sorts of file types that are in there that I don't care about, if I can't use multiple
def:
statements. But I'll at least try that with the directories and see if that works. Honestly i think I might be easier just making a backup and manually search + delete those folders for now. -
Patrick Seymour almost 9 yearsI obviously don't know your folder structure and contents. I was just saying that I personally find includes easier for code. Your mileage may vary and often does.
-
endolith about 3 yearsbitbucket link is dead and winmerge is maintained
-
RockResolve about 3 yearsSince I wrote this winmerge was revived, and the WinMerge2011 stagnated and died. So I switched back to winmerge 2.16