Home

folder-diff

Advertisement
Advertisement

How to Compare Two Folders Online

The Folder Diff tool lets you compare two folder structures side by side and generates a color-coded report showing exactly what changed between them. Whether you are verifying a backup, checking a deployment, or auditing a file sync, this tool tells you in seconds which files are missing, which were added, and which were modified.

Upload Folder A (the original or baseline) into the left zone by dragging the folder from your file manager or clicking to browse. Then upload Folder B (the updated or target version) into the right zone. The tool reads every file's relative path, size in bytes, and last-modified timestamp from the HTML5 File API.

Click the Compare button to generate the diff report. The report displays four categories: files that are missing (present in A but absent in B), files that were added (present in B but absent in A), files that were modified (same path but different size or timestamp), and files that are unchanged. Each category is color-coded for quick visual scanning.

The comparison uses relative paths, so it works correctly even if the two folders have different root names. For example, comparing "backup-jan" and "backup-feb" will correctly match files by their relative paths within each folder structure.

When You Need Folder Comparison

Backup Verification: After copying a folder to an external drive or cloud storage, compare the source and destination to verify that every file transferred correctly. A single missing file in a backup can mean lost data when you need it most.

Website Deployment: Before pushing a new version of a website to production, compare your local build directory with the current production files. This catches accidentally deleted files, missing assets, and stale files that should have been updated.

Code Migration: When migrating a codebase from one repository to another, or from one hosting platform to another, folder comparison ensures that no files were lost in transit. This is especially important for large projects with hundreds of configuration files, templates, and assets.

Sync Auditing: File sync tools (Dropbox, Google Drive, OneDrive) occasionally fail to sync certain files due to path length limits, filename conflicts, or permission issues. Comparing your local folder with the cloud version reveals any files that the sync tool missed.

Content Inventory: Digital asset managers need to verify that all required files are present in a content delivery folder. Comparing against a manifest or previous version ensures completeness.

How the Comparison Algorithm Works

The tool builds an index of all files in each folder using their relative paths as keys. This creates two hash maps: one for Folder A and one for Folder B. The comparison then iterates through the union of both maps:

For each unique path, the tool checks four conditions. If the path exists in A but not in B, the file is marked as missing. If it exists in B but not in A, it is marked as added. If it exists in both but the size or timestamp differs, it is marked as modified. If the path, size, and timestamp all match (within a 2-second tolerance for filesystem timestamp precision), the file is marked as unchanged.

This indexed approach has O(n) time complexity where n is the total number of unique files across both folders. Even with 10,000+ files, the comparison completes in well under a second. The tool does not read file contents — it only compares metadata — so it is fast regardless of file sizes.

Frequently Asked Questions

How does the tool determine if a file was modified?

The tool compares two attributes: file size in bytes and last-modified timestamp. If either value differs between Folder A and Folder B for the same relative path, the file is marked as modified. A 2-second tolerance window accounts for filesystem timestamp precision differences between operating systems and copy methods.

Can I compare folders with thousands of files?

Yes. The comparison algorithm uses indexed object lookups with O(1) per-file complexity, not nested loops. Folders with 10,000 or more files compare in under a second. The bottleneck is usually the initial file enumeration from the browser's File API, which depends on your disk speed and the number of files.

Does this tool require any software installation?

No installation required. The tool runs entirely in your browser using the HTML5 File API and the webkitdirectory attribute for folder selection. It works in Chrome, Firefox, Edge, and Safari on desktop. Mobile browsers have limited support for folder selection, so a desktop browser is recommended.

Is my data sent to any server?

No. All file comparison happens locally in your browser. The tool reads only file metadata — relative path, size, and timestamp — from the File API objects. It never reads file contents and never transmits any data over the network. Your folder structures and file information remain completely private.