Compare Files in Different Folders

The following is AI-generated (aka vibe-coded) software. The software is specific to my needs and my system and may not work for you or your system. Support is limited, but if you report a bug I'll certainly look into it. All code is provided in a zip file for you to review should you choose.

Pick two folders, and the app lists every file in both, with their subfolders, in one table: which files are the same, which differ, which copy is newer, and which are in one folder only. It is a single Python script with a window (Tkinter), and needs nothing beyond the Python standard library.

Contents

Requirements

  • Python 3.8 or later, with Tkinter (python.org installers include it; on Debian and Ubuntu: sudo apt install python3-tk).
  • Optional: Pillow, only to show the window icon outside Windows.

Running it

python compare-files-in-different-folders.py

On Windows, pythonw.exe runs it without a console window. The window opens where it was last closed, at the same size, and maximized if it was.

Comparing two folders

Type or paste a folder in Folder A and Folder B (or use Browse…), then click Compare folders (or press F5, or Enter in a field). The status bar shows the progress, and then the result: green when every file could be read, red, starting with ⚠, when some couldn’t.

Each file gets a status:

Status Meaning Shown in
Identical In both folders, with the same size and modified date (within the date tolerance). With Verify contents on: the same contents, whatever the dates. Green
Different The same modified date, but a different size or different contents. Red
Newer in A, Newer in B The modified dates differ, and that folder’s copy is newer. Bold black
Only in A, Only in B The file is in one folder only. Gray

Files are matched by name, wherever they are in the subfolders. A name found more than once in a folder is paired with every copy in the other folder. With Match paths too on, a file is paired only with the file at the same path in the other folder (docs\notes.txt with docs\notes.txt, not with old\notes.txt).

The Content column says whether the contents are the same (Same), differ (Differs, always known when the sizes differ), weren’t checked (Not checked), or couldn’t be read (Read error).
The date and size columns are green when the two copies match and red when they don’t.

Files and folders that can’t be read (permission denied, for example) aren’t left out silently: View errors lists them, with the reason, in a window that opens where it was last closed. Close it with Esc.

Options

All of them are remembered between sessions.

  • Case-insensitive file names: Report.PDF and report.pdf are the same file, as Windows treats them. The row shows both names (Report.PDF ↔︎ report.pdf). With Match paths too, it covers the folder names as well.
  • Match paths too: off (the default), files are paired by name wherever they are; on, only files at the same path from the chosen folders are compared, and a file moved to another subfolder shows as Only in A and Only in B. Verify contents then reads only files that are paired this way.
  • Verify contents of same-size files: reads and compares the contents of files whose sizes match, so same-size files with different contents are caught, and copies whose dates were reset are recognized as identical. Slower on large folders; the status bar shows how far it has got.
  • Date tolerance: how many seconds apart two modified dates can be and still match, from 0 to 86,400 (a day). FAT32 and exFAT drives keep times to 2 seconds, so 2 is the default.
  • Also match dates exactly 1 hour apart: for files copied across a daylight saving change, or to and from FAT drives.
  • Exclude: patterns separated by ;, with the wildcards * and ?. A pattern without a backslash is matched against file and folder names at any depth (Thumbs.db; *.tmp; .git); one with a backslash (or a forward slash) is matched against the path from the chosen folder (build\*). Excluded folders aren’t scanned at all. The status bar says how many files and folders were excluded.

The table

  • Click a heading to sort by it; click again to reverse. A triangle marks the sorted column. The sort holds when you compare again, and is remembered.
  • Drag a heading’s right edge to resize the column, or double-click the edge to fit the column to its contents. Columns fit their contents until you resize one; from then on your widths are kept, and remembered.
  • Show hides or shows each status; each check box shows how many files have it. Search keeps the rows whose name or paths contain the text. The status bar says how many rows are shown.
  • Right-click a text field for Cut, Copy, Paste and Select all.

Exporting

Export to TSV… writes the rows shown, in the table’s order, to a tab-separated file that opens in Excel: UTF-8 with a byte-order mark (so accented names read correctly), Windows line ends, a heading line, and the texts as shown. A tab or line break inside a name becomes a space.

Settings

Settings are kept in compare-files-in-different-folders.ini in the working folder: the folder holding the script (or the executable), or the folder given with --working-folder-path. They are saved when you compare and when you close the window; if they can’t be saved (the script is in a folder you can’t write to), a message says so, once a session.

Versions from 2026-10-07 kept the settings in %APPDATA%\compare-files-in-different-folders on Windows (~/.config/compare-files-in-different-folders elsewhere), and earlier ones beside the script, in older sections. The first time this version starts with no settings in its working folder, it reads the newest of those old files, so your folders and options carry over; the old file is left as it is, and can be deleted.

Command line

python compare-files-in-different-folders.py [--working-folder-path FOLDER]

Options can come in any order, as --name VALUE or --name=VALUE. --help lists them, with their defaults.

Option What it does
--working-folder-path FOLDER The folder for the settings file and temporary files, created if needed. Blank: the script’s folder. A folder that can’t be created is an error.
--help Lists the options and exits.

A mistake on the command line (an unknown option, an option without its value, a bare file name) prints an error and exits with status 2; without a console it is shown in a message box.

Keyboard shortcuts

Keys What they do
F5 Compare the folders.
Enter In a folder field, the date tolerance or the exclude field: compare the folders.
Ctrl+A In a text field: select all.
Esc In the errors window: close it.

Testing

python -m pytest

The tests need pytest; the window tests need a display (on Linux without one, the tests start Xvfb and openbox if they are installed, and skip the window tests if not). tests/test_compare.py checks the comparison, the export, the old settings, the command line and running without Tkinter, without a window; tests/test_app.py drives the real window: comparing, filtering, sorting, column widths, the errors window, exporting, saving and restoring the settings and the window, the colors, the controls’ heights, display scaling, the fit at the minimum window size, and closing during a comparison.

On 2026-11-03 the 36 tests passed in 8.4 s at 100% display scaling and in 8.9 s at 150% (Xvfb at 144 dpi), on Linux with Python 3.12.

tools/make_icon.py draws the icon (compare-files-in-different-folders.ico, with Pillow).

Troubleshooting

  • “Tkinter is not available”: install Tkinter for your Python (see Requirements).
  • The window opens at the default place: the place it was closed at is off every monitor now (a monitor was unplugged), so it opens where it can be seen.
  • Files are missing from the results: check View errors, and the Exclude field.
  • Files show as Newer although they are the same: their dates differ by more than the date tolerance. Raise the tolerance, tick “Also match dates exactly 1 hour apart”, or turn on Verify contents.
  • “Settings not saved”: the working folder can’t be written. Choose another with --working-folder-path.

Limitations

  • Files are matched by name (or, with Match paths too, by path): a file that was renamed shows as Only in A and Only in B.
  • Without Verify contents, two files with the same size and date count as identical even if their contents differ.
  • Comparing runs in the window’s own thread: the window stays responsive through progress updates, but a single very slow file read (a network drive) can pause it.
  • Long paths are cut at the column’s edge until you widen the column.
Download Release:

⬇️ Compare Files in Different Folders.zipLast Updated: November 4, 2026
(1 votes, average: 5.00 out of 5)

Leave a Reply

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail.