Can you hard link images, and thereby conserve space? The short answer appears to be no, although it ought to be yes.
It might help if we have a little background on how the New Technology File System works prior to answering the question in greater detail... When you navigate the directory structure you have files and folders within folders which are all hierarchically organized. However, this isn't how things are organized on the hard drive disk. The disk will be made up of sectors. where data is written. The directory structure is essentially a human convenience that gets mapped on to the hard drive. The map itself is a master file table that tells the system where a given path and file name resides on the hard drive.
What hard links do is create additional entries in the master file table for the same file. So if you create a hardlink, you aren't actually creating a separate file or copy. If you make changes to one "file" these get reflected in the other because they are actually the same file. Thus no additional space is used when you create a hardlink.
In a certain sense this is comparable to a shortcut link, or "soft link." A soft link is a special type of file that contains a string (text) encoding the file path to the target file. However, since these "soft links" are files of a special type, depending upon the software, a given program may or may not be able to read the file to determine its target. Furthermore, if you move the target file that the soft link refers to, then the soft link isn't automatically updated to reflect this and as a result the soft link is broken.
This isn't the case with a hard link. The hard link is the same file, but simply existing as a separate entry in the master file table. As such it is of the same type, and programs will treat it exactly the same way as "the original file." Furthermore, you can move the "original file" and the "hard link" independently of one another and they will continue to refer to the same data, such that changes in one are automatically reflected in the other.
Hard links can be created with the following code...
C++:
C++:
BOOL WINAPI CreateHardLink(_In_ LPCTSTR lpFileName, _In_ LPCTSTR lpExistingFileName, _Reserved_ LPSECURITY_ATTRIBUTES lpSecurityAttributes);
VBA:
Code:
Private Declare Function CreateHardLink Lib "kernel32.dll" Alias "CreateHardLinkA" (ByVal lpFileName As String, ByVal lpExistingFileName As String, ByRef lpSecurityAttributes As Any) As Long
cmd.exe:
Code:
mklink /h NewName, OldName
If you use these functions (commands) on a text file, a hard link will be created that will act as I have described. However, they don't work as they are supposed to on an image file. Likewise, they do not work as they should on, for example, an Excel file. If you try to create a hard link to an image file, then it will appear to work, that is, until you edit and save one file's image or the other. At that point you will see that changes in one file's image do not get reflected in the other file's image.
Therefore these would seem to be different files. But this isn't entirely true, either. If you right-click one file to bring up its properties window, then select the "details" tab, you will see that there are details that you can edit, such as the "Title" or "Subject". Change those in one file and they will get reflected in the other. Apparently the hard link isn't to the binary data but to the details - which exist in an alternate data stream within the same file, but as a stream of data separate from the primary data stream.
Anyway, I had certain problems that would have been easy to solve were it possible to create a hard link to an image. But it would appear that hard links apply to text files, not images.