Table of Contents Hide
What Are Hard Links in Windows?
A hard link is a new directory entry that refers to the same actual file on an NTFS disk. For example:- File A: 500 MB
- File B: 500 MB (duplicate)
- File A stays
- File B is a hard link to File A
Why Replace Duplicate Files with Hard Links?
There are various reasons why most people opt for this technique. Saves Hard Drive Space The actual file is present once. Preserves File Structure Software will continue using files from their respective folders. Quicker Process No need to make changes in software and folder links. Easy Access Most software is unable to differentiate between a file and a hard linked file.Important Conditions Prior to Making Hard Links
Before creating hard links in order to delete duplicate files on your computer running Windows, you must have the following:- Ensure both files are identical.
- Both files should be on an NTFS partition.
- Files should be present on the same drive.
- Hard linking is done for files, not folders.
- Make sure to back up important files.
#1: Replace Duplicate Files with Hard Links Using Command Prompt
This is Microsoft’s native way. Step 1: Find Identical Files First, you need to locate the two identical files that are on an NTFS partition. Example:D:\Projects\File1.docx
D:\Backup\File1.docxStep 2: Remove One Copy Next, you can remove the identical file as per your choice. In the example above:
D:\Backup\File1.docxStep 3: Launch Command Prompt as Administrator Look for: Command Prompt And click: Run as Administrator Step 4: Create the Hard Link Enter the following command line:
mklink /H "D:\Backup\File1.docx" "D:\Projects\File1.docx"Alternatively, you may use fsutil.exe utility:
fsutil hardlink create "D:\Backup\File1.docx" "D:\Projects\File1.docx"The system will create a new entry in the directory that will refer to the file, but not contain it. Step 5: Check Open both locations. You will find:
- Both files reside in their places.
- Open any of them to see identical content.
- Storage space is taken by one file only.
#2: Replace Duplicate Files with Hard Links Using PowerShell
By using this approach, you can replace the duplicate files with Hard links but it is a bit technical. Here are the following process: Step 1 At first, Launch PowerShell with Administrative rights. Step 2 Next, remove the duplicated file. Step 3 Execute:New-Item -ItemType HardLink -Path "D:\Backup\File1.docx" -Target "D:\Projects\File1.docx"Step 4 Ensure that both files work fine. PowerShell is a handy tool when automation of linking files is required.
#3: Replace the Duplicate Files using Automated Software
Finding many files manually could take lots of time. For those seeking a more effective way, SysTools Duplicate Finder Software provides the most convenient solution through scanning the storage places for similar files using effective comparison techniques. The software will help you identify the duplicates easily, which is very important in dealing with redundant files.
How to Confirm Hard Links Were Created?
Windows has a tool for listing all hard links that point to a file. Open the Command Prompt:fsutil hardlink list "D:\Projects\File1.docx"Now, the output of this script will show all the paths pointing to that particular location of the same file record.
Hard Links vs Symbolic Links
| Feature | Hard Link | Symbolic Link |
| Same Drive Required | Yes | No |
| Supports Files | Yes | Yes |
| Supports Folders | No | Yes |
| Breaks if Original Deleted | No | Yes |
| Uses Same Physical Data | Yes | No |
- With a hard link, the linked file will appear just like a regular file. There won’t be any shortcut arrows or other visual cues which indicate the presence of a hard link.
- On the contrary, the symbolic link will usually have a link/shortcut icon which makes it obvious to the user that it does not actually contain any data. This is one of the reasons why people prefer to use hard links when there are duplicate files which need to be transparent for users and applications.
Frequently Asked Questions
Can Windows create hard links for duplicate files automatically?
Windows allows creation of hard links but does not search for duplicates and create hard links to save storage space. However, for automation, you may require 3rd party software to hard links instead of duplicate files.
Does hard links consume less storage space in comparison to actual data?
Yes, it saves a significant amount of space as several files point to a single data copy of the file.
Can I create hard links to the files in USB drives?
If the USB drive is formatted using NTFS, then yes.
Are hard links reliable?
If the files are indeed identical and you know that any changes applied via one hard link affect all other names.
Can hard links be reverted to normal?
Yes. Deletion of a hard link deletes just the directory entry. The data will be available until another hard link is left.