Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I wrote a similar (but simpler) script which would replace a file by a hardlink if it has the same content.

My main motivation was for the packages of Python virtual envs, where I often have similar packages installed, and even if versions are different, many files would still match. Some of the packages are quite huge, e.g. Numpy, PyTorch, TensorFlow, etc. I got quite some disk space savings from this.

https://github.com/albertz/system-tools/blob/master/bin/merg...



This does not use hard links or symlinks; this uses a feature of the filesystem that allows the creation of copy-on-write clones. [1]

[1] https://en.wikipedia.org/wiki/Apple_File_System#Clones


So albertzeyer's script can be adapted to use `cp -c` command, to achieve the same effect as Hyperspace.


If you'd like. In the blog post he says he wrote the prototype in an afternoon. Hyperspace does try hard to preserve unique metadata as well as other protections.


uv does this out of the box, I think other tools (poetry, hatch, pdm, etc.) do as well but I have less experience with the details.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: