I am creating a zip archive containing two identical files at different paths. Does the zip archive format support something akin to the Unix concept of hard links? By this I mean the ability to store the file only once (saving space), but to index that data blob to two different paths within the zip archive.
If the file format does support this, how could I go about creating such an archive using free tools in Ubuntu?
Hard limits While useful, there are some limitations to what hard links can do. For starters, they can only be created for regular files (not directories or special files). Also, a hard link cannot span multiple filesystems. They only work when the new hard link exists on the same filesystem as the original.
Because inodes are unique to a filesystem, and hard links are mappings of name:inode, you cannot create links across filesystems.
The reason hard-linking directories is not allowed is a little technical. Essentially, they break the file-system structure. You should generally not use hard links anyway. Symbolic links allow most of the same functionality without causing problems (e.g ln -s target link ).
Hard links only work on Microsoft Windows operating systems that support NTFS partitions (Windows NT 4.0 or later) while FAT and ReFS file systems do not work with hard links. An example of using hard links is when a user needs to have a file stored in two different folders.
No, the Zip file format does not support this. This is because the Local File Header contains information about the file, including its name, followed immediately by the compressed data for the file. It is not possible for two different Local File Headers to point to the same compressed data.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With