To replace duplicate files with links on Windows, you keep one real copy of the file and turn every other copy into a link that points to the same data. On an NTFS drive the usual choice is a hard link, created with mklink /H in Command Prompt: every folder still shows the file and every program can open it, but the data is only stored once. It is the right answer when the same file genuinely needs to live in several folders, and the wrong one when the copies need to change independently.
Below is how links work, how to create them by hand, and the limits you should know before you replace anything.
Why replace duplicates instead of deleting them?
Deleting duplicates is simplest, but sometimes a copy exists for a reason:
- A project folder needs a logo, font or reference clip that also lives in your main library.
- A music track belongs to both an album folder and a playlist or DJ folder.
- A program or script expects a file at a fixed path.
- Different people on a shared PC look for the same file in their own folders.
Deleting the copy would break those uses. A link keeps every path working while you stop paying for the same data twice.
The types of link on Windows
| Type | What it is | Works across drives? | If the original is deleted | Saves space? |
|---|---|---|---|---|
| Shortcut (.lnk) | A small file that File Explorer follows | Yes | Shortcut breaks | Yes, but many programs cannot open a shortcut as if it were the file |
| Hard link | A second name for the same data on disk | No, same NTFS volume only | Data stays until every name is deleted | Yes |
| Symbolic link | A pointer to a path that programs follow automatically | Yes | Link breaks | Yes |
| Junction | A pointer for folders, similar to a symbolic link | Yes, local drives | Junction breaks | Yes, for whole folders |
For duplicate files on the same drive, hard links are usually best. There is no "original" and "copy": both names are equal, programs cannot tell the difference, and deleting one name leaves the other working.
How to create a hard link by hand
You can replace a single duplicate with a hard link using Command Prompt. Make sure you have a backup of the file first.
- Confirm the two files really are identical. In PowerShell,
Get-FileHash "path1", "path2"should show matching hashes. - Delete or move the duplicate you want to replace, for example D:\Projects\Brochure\logo.png, keeping the copy in your main folder, for example D:\Brand\logo.png.
- Open Command Prompt. Hard links do not need administrator rights as long as you have access to both folders.
- Run:
mklink /H "D:\Projects\Brochure\logo.png" "D:\Brand\logo.png" - Windows replies "Hardlink created". Open the project folder and check the file opens normally.
In PowerShell the equivalent is New-Item -ItemType HardLink -Path "D:\Projects\Brochure\logo.png" -Target "D:\Brand\logo.png".
To link to a file on a different drive, use a symbolic link instead: mklink "C:\Users\you\Music\Set\track.mp3" "E:\Music\Album\track.mp3". Symbolic links need an administrator Command Prompt unless Developer Mode is turned on in Settings, and they stop working if the target drive is disconnected or the target file is moved.
Only create links inside your own folders: Documents, Pictures, Music, Videos, project and data folders. Never replace files in C:\Windows, Program Files or AppData with links. Programs and Windows itself manage those folders and may update or replace files in ways that break links.
Limits to know before you start
Editing a linked file
Because hard links share the same data, an edit made through one name should appear under every name. That is great for files that must stay in sync, and a problem if you expected the copies to be independent. There is also a twist: many programs save by writing a brand new file and swapping it in. When that happens, the name you edited gets its own new data and the link is quietly broken, so the other names keep the old version. Links work best for files you read rather than edit, such as photos, music, video clips, fonts and finished documents.
Drive formats
Hard links and symbolic links need NTFS. Many external drives and USB sticks are formatted as exFAT or FAT32, which do not support them. Check under This PC, right-click the drive and choose Properties to see its file system.
Size reports
File Explorer shows the full size of a hard-linked file in every folder, so folder totals can look as if nothing was saved. The space really is shared; check the drive's free space in This PC instead of adding up folder sizes.
Backups, sync and copying
Some backup and cloud sync tools treat each hard link as a separate file and store it twice in the backup. Copying a folder to another drive with File Explorer also turns links back into full copies. That is safe, but it means the space saving only applies on the drive where you made the links.
Deleting
Deleting one name of a hard link frees no space until the last name is deleted. With a symbolic link it is the reverse: delete the target and every link to it breaks.
When links are the wrong choice
- Backups. A backup copy must be a separate copy. Linking it to the original means one disk failure or one accidental edit affects both.
- Working copies. If you keep "before" and "after" versions of a document, they must stay separate files.
- Files on different drives that need to keep working when one drive is unplugged.
- Simple clutter. If nobody needs the second copy, removing it is simpler than linking it. Our guide on whether it is safe to delete duplicate files helps you decide.
Replacing many duplicates at once
Doing this by hand is fine for a handful of files. For hundreds of duplicates, typing mklink commands gets slow and it is easy to link the wrong pair. Drive Sweeper finds duplicates by comparing their content, keeps the best copy in each group and can replace the rest with links, so every folder still works while the data is stored once. With Drive Sweeper you review each group before anything changes, and the files it removes stay in a restore area for 30 days in case you change your mind.
A sensible approach is to remove obvious clutter, such as copies in Downloads and old desktop folders, and use links only for the copies that have a reason to exist. Our guide to finding duplicate files with different names explains how to find those copies in the first place, and removing duplicate songs from a music library shows where links help with playlists.
Quick reference
mklink /H new-name existing-file: hard link, same NTFS drive, no admin needed.mklink new-name existing-file: symbolic link to a file, any drive, admin or Developer Mode needed.mklink /J new-folder existing-folder: junction for a whole folder.fsutil hardlink list "path": lists every name a hard-linked file has (run as administrator).
Used for the right files, links give you the space back without the risk of breaking a project, playlist or script that expects a file to be where it always was.
Frequently asked questions
What is the difference between a hard link and a shortcut?
A shortcut is a small .lnk file that points to another file. A hard link is a second directory entry for the same data, so apps treat it exactly like the original file.
Can a hard link point to a file on another drive?
No. Hard links only work within the same NTFS volume. A symbolic link can point across drives but needs the target to stay where it is.
What happens if I edit a linked file?
With a hard link, every name shows the change because they share the same data. If you need independent copies, do not replace them with links.
