Imagine asking AI to help tidy a launch folder. Two files share the name “brief”, while a third is called “brief-copy”. It is tempting to treat the repeated name as the duplication and the extra word as evidence of a spare. Neither label tells you what is inside.
A useful cleanup separates two decisions: which files have matching contents, and which copies still serve a purpose. Give each decision its own evidence. The first needs a dependable comparison; the second needs context about the work, the people using it and the reason a copy exists.
Define the kind of match you need
Microsoft’s Get-FileHash documentation explains that a content hash is calculated from a file’s contents. Renaming a file does not change that hash, while a file’s contents can change without its name changing. PowerShell uses SHA-256 by default for this command.
For a byte-for-byte duplicate review, record the complete path and the comparison method. Names and file sizes can help organise an inventory, but they should not be the final decision rule. A result should identify the particular files compared and whether their contents were actually examined.
Keep the business question separate. Two documents might be different files representing competing drafts. Two identical files might be deliberately retained for different purposes. Deciding which version is approved requires information that a filename alone cannot supply.
Try three small files with known answers
For this article, a controlled test used three disposable text files. Each contained seven ASCII characters followed by one line-feed character, making eight bytes:
- A —
working/brief.txt:Draft=Afollowed by a line feed. - B —
incoming/brief.txt:Draft=Bfollowed by a line feed. - C —
archive/brief-copy.txt: an exact byte-for-byte copy of A.
All three were deliberately given the same modification time. A and B therefore had matching names, sizes and timestamps, but different contents. A and C had different names and identical contents. These are constructed examples, not files from a real creator’s archive.
Using Python’s documented SHA-256 hashing functions, A and C produced matching hashes; B produced a different hash. A direct content comparison also confirmed that A matched C and differed from B. The exercise supplies known answers against which a proposed duplicate finder can be checked.
Check what a comparison function actually compares
Python’s filecmp documentation provides a concrete trap. Its cmp function defaults to shallow=True. When file type, size and modification time match, that mode can treat files as equal without comparing their contents.
In the controlled test, the default comparison of A and B returned True. With shallow=False, it returned False. The content comparison of A and C returned True. Their contents remained unchanged throughout the checks.
If AI has helped write a cleanup script, ask the reviewer to identify the exact comparison being used. A function called “compare files” may have options that matter to your intended definition of a duplicate. Include the same-size, different-content case in a small test batch before trusting its report.
The useful question is specific: does this implementation read the relevant contents, or can it return a match from metadata? Have unreadable files and comparison errors reported separately. Missing evidence should remain an unresolved result.
Make the first deliverable an inventory
For an accessible local file in PowerShell 7.5 on Windows, a documented command pattern is Get-FileHash -LiteralPath 'C:\Cleanup-Test\working\brief.txt' -Algorithm SHA256. Replace the illustrative path with the file you intend to inspect. Microsoft documents -LiteralPath as using the path without interpreting wildcard characters.
This computes a hash; it does not decide which copy to retain. Use the same algorithm when comparing results, and retain the full values in the report. A compact review inventory can include:
- The original complete path for every candidate.
- The file size and comparison method, including the hash algorithm where used.
- The full hash or content-comparison result.
- Any read failure or unresolved comparison.
- The known purpose of the copy, followed by a proposed action and reason.
Let deterministic comparison establish the candidate groups. If AI helps interpret the inventory, ask it to preserve every original path, distinguish observed matches from assumptions and flag missing context. Check its proposed selection against the underlying report before allowing a change.
Establish whether you have copies or references
Cloud workspaces need an additional distinction. Google Drive’s organisation guidance describes a shortcut as a link to another file or folder. Deleting the shortcut does not delete the original. Two visible entries therefore need not represent two independent content copies.
Identify what each entry represents before applying a local-file comparison workflow. A cloud document, an exported local file and a shortcut are different objects to account for in the inventory. A title repeated in several locations is a starting point for investigation.
For confirmed content copies, establish their roles. In a hypothetical project, one may be an approved delivery copy while another is retained in the project record. The matching bytes establish something useful about content; they do not establish that either location is unnecessary.
Review the proposed selection before changing files
For the three-file test, the report should keep B outside A and C’s content-match group. The next question is why A and C exist. The folder labels “working” and “archive” do not themselves prove which copy is approved or which should survive.
A practical review can ask who uses each copy, whether anything depends on its location and what recovery option exists before an approved removal. Keep unresolved cases in place. This is a proposed workflow, not a claim that every AI-generated script implements it.
If the plan also changes names, MaryChuks’ guide to previewing a complete file-renaming batch explains how to review destinations and collisions. Keep the duplicate decision and the renaming proposal individually inspectable.
The finished job should leave you able to explain both the matching evidence and the selection. AI assistance can help organise that explanation when it works from a verified inventory. The decision to keep a copy should remain connected to what the file contains and what your work still needs.
Sources
Documentation checked on 28 October 2026. The eight-byte example was verified with disposable local files using Python’s hashlib and filecmp modules. The PowerShell command follows the cited documentation; it was not executed for this article.
- Microsoft: Get-FileHash (PowerShell 7.5 reference).
- Python: hashlib (SHA-256 hashing).
- Python: filecmp (shallow and content comparisons).
- Google Drive: Organize your files (shortcuts and originals).
Discover more from Marychuks.com AI, Psychology, Business & CreativeVerse
Subscribe to get the latest posts sent to your email.