tinyapps.org / blog


Replace dupes with hard links or shortcuts #

This KB article explains hard links:
A hard link is a folder entry for a file regardless of where the actual file data exists on that volume. Every file is considered to have at least one hard link. On NTFS volumes, each file can have multiple hard links; therefore, a single file can be displayed in many folders (or even in the same folder with different names). Because all of the links reference the same file, programs can open any of the links and modify the file. A file is deleted from the file system only after all of the links to it have been deleted. After you create a hard link, programs can use the link like any other file name. Note that Windows Explorer and a command prompt will show all linked files as being the same size, even though they all share the same data and do not actually use that amount of disk space.
This last bit can be confusing. Let's say you've got a folder with three duplicate files of 10MB each. After replacing the dupes with hard links, the folder size is still reported as 30MB by Windows Explorer and cmd.exe. However, the "Used space" reported by Windows Explorer for the volume will have decreased by 20MB.

/windows | Feb 20, 2011


Subscribe or visit the archives