WinMerge:如何排除 *.bak 和 *.tmp 文件?

WinMerge:如何排除 *.bak 和 *.tmp 文件?

如何在 WinMerge 比较对话框窗口中包含所有文件并排除 *.bak 和 *.tmp 文件?

=========== WinMerge Dialog Window ===========

Left: [Folder-A]               [ OK ]
Right: [Folder-B]              [ Cancel ]
Filter: *.*                    [ Help ]

[x] Include Subfolders

----------------------------------------------

答案1

使用包含式过滤器,除符合过滤规则的文件外,所有文件均会包含在内。对于 .tmp 和 .bak 文件,情况如下:

def: include ## Inclusive (loose) filter lets through all items not matching rules
f: \.tmp$ ## temporary files
f: \.bak$ ## back up files

选择文件或文件夹时,点击过滤器文本框旁边的选择按钮来选择过滤器。然后点击新建,选择文件名并按照上述步骤调整过滤器。保存后,您可能需要关闭并再次打开过滤器页面来刷新它。选择您的新过滤器,然后就大功告成了。

答案2

排除 *.bak 和 *.tmp 文件自 WinMerge 2.16.19 起

In 2.16.19 and later, if you put an exclamation mark(!) in front of a mask, files matching that mask will be excluded. Also, a backslash(\) after the mask will cause the mask to match folders instead of files.

Example 2. Excluding folders (In 2.16.19 or later)

In this command-line example, the folder compare operation excludes .git and .vs folders:

WinMergeU c:\project\docs c:\temp /f !.git\;!.vs\

使用此过滤器

*.*;f:!*.bak;f:!*.tmp

添加后,您将能够排除 *.bak 和 *.tmp 文件。

PS L:\temp\winmerge> Get-ChildItem .\folder1\


    Directory: L:\temp\winmerge\folder1


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----         4/30/2023   8:19 PM              0 file1.txt
-a----         4/30/2023   8:19 PM              0 file2.bak
-a----         4/30/2023   8:19 PM              0 file3.tmp


PS L:\temp\winmerge> Get-ChildItem .\folder2\


    Directory: L:\temp\winmerge\folder2


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----         4/30/2023   8:19 PM              0 file1.txt
-a----         4/30/2023   8:19 PM              0 file2.bak
-a----         4/30/2023   8:19 PM              0 file3.tmp

*.bak 和 *.tmp 文件将被跳过。此处为 Winmerge 输出示例

file1.txt       Text files are identical      4/30/2023 8:19:05 PM    4/30/2023 8:19:05 PM  txt
file2.bak       File skipped      4/30/2023 8:19:05 PM    4/30/2023 8:19:05 PM  bak
file3.tmp       File skipped      4/30/2023 8:19:05 PM    4/30/2023 8:19:05 PM  tmp

答案3

您可以使用过滤器。请参阅这里,第 4.1.3 节。创建文件过滤器

相关内容