Рекурсивное сравнение двух каталогов, за исключением \ bin \ и \ obj \

3327
sab669

Я пытаюсь использовать WinMerge для сравнения двух каталогов:

C: \ Users ... \ Desktop \ Сравнить \ 35_A

C: \ Users ... \ Desktop \ Сравнить \ 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 

Последние 3 строки не являются частью фильтра, я добавил их, пытаясь игнорировать все и вся во всех каталогах \ bin \ и \ obj \. Я пробовал оба, def: includeи def: excludeни один не дает точных результатов.

Я просмотрел справочную документацию в WinMerge о файловых фильтрах, но не понимаю этого.

1

3 ответа на вопрос

2
Patrick Seymour

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$ 
Мне нужно было бы пойти и добавить неисчислимое количество фильтров для всех типов типов файлов, которые мне там безразличны, если я не могу использовать несколько операторов `def:`. Но я по крайней мере попробую это с каталогами и посмотрю, работает ли это. Честно говоря, я думаю, что мне может быть проще сделать резервную копию и вручную искать + удалять эти папки. sab669 8 лет назад 0
Я, очевидно, не знаю структуру и содержимое вашей папки. Я просто говорил, что лично мне легче найти код Ваш пробег может меняться и часто меняется. Patrick Seymour 8 лет назад 0
Справедливо. Я просто удивлен, что вы не можете использовать как включить, так и исключить. Или хотя бы два отдельных фильтра. Там есть только куча текстовых файлов, изображений, почтовых индексов и несколько проприетарных форматов. sab669 8 лет назад 0
1
heavyd

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))$ 
0
RockResolve

У меня был некоторый ограниченный успех с ответом @ heavyyd, но позже я обнаружил, что это намного проще в очевидном преемнике WinMerge WinMerge2011.

С WinMerge2011 я использовал

xd: \\bin(\\.+|)$ xd: \\obj\\ 

Найти документацию может быть сложно, но я нашел http://forums.winmerge.org/viewtopic.php?f=4&t=1010

Фильтры файлов / каталогов были улучшены в WinMerge 2011, что позволяет комбинировать правила включения и исключения. Отсутствие метки def: в файле .flt приводит к тому, что f: и d: работают как правила включения, за исключением случаев, когда перед ними стоит префикс x, в этом случае они действуют как правила исключения. Метки f: и d: с необязательным префиксом x для формирования правила исключения также могут использоваться с фильтрами подстановочных знаков.

К вашему сведению WinMerge, похоже, больше не разрабатывается. Смотрите обзорные заметки в https://en.wikipedia.org/wiki/WinMerge . Загрузите WinMerge2011 по адресу https://bitbucket.org/jtuc/winmerge2011/downloads/