The Computer Oracle

WinMerge: How to exclude *.bak and *.tmp files?

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: RPG Blues Looping

--

Chapters
00:00 Winmerge: How To Exclude *.Bak And *.Tmp Files?
00:23 Accepted Answer Score 17
00:59 Answer 2 Score 5
01:53 Answer 3 Score 0
02:06 Thank you

--

Full question
https://superuser.com/questions/726526/w...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#winmerge

#avk47



ACCEPTED ANSWER

Score 17


Using an inclusive filter, all files are included except those matching a filter rule. For .tmp and .bak files that would be:

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

When selecting a file or folder, hit select right next to the filter textfield to select a filter. Then hit new, select a filename and adjust the filter by the above lines. After saving, you may have to refresh the filter page by closing and opening it again. Select your new filter and voila.




ANSWER 2

Score 5


You exclude *.bak and *.tmp files as of 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\

Use this filter:

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

After adding it, you'll be able to exclude *.bak and *.tmp files.

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 and *.tmp files will be skipped. Example Winmerge output here

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



ANSWER 3

Score 0


You can use a filter. See here, section 4.1.3. Creating a file filter.