4 ms·
What if you were to symlink your entire tree to say /z - as far as I'm aware, this would not use much more disk space, and as it would be the last to go, could
by jurjenh 17y ago
What if you were to symlink your entire tree to say /z - as far as I'm aware, this would not use much more disk space, and as it would be the last to go, could you not call /z/bin/whatever ?
I may be way wrong here, but I thought the symlink would still work with the original being deleted, because the file system won't actually mark the file as gone until all links are gone.
Would (or does) this work? Haven't got access to a unix box right now, so can't try myself, but thought it might be a naive failsafe (at least until you actually wait for rm -rf * to finish...)
- yason 17y agoSymlinks won't save you but you could use hardlinks to make two pointers to the same file. You would have to do it for each file — was it cp -l which would do that.
- pronoiac 17y agoOn Linux, I've used "cp -al" to make a forest of hard links, consuming little space.
- blasdel 17y agoThat's called a link (a hard link). It's just another reference to the inode on disk, indistinguishable from the original. All regular files are hard links, most just have a link count of 1. Symlinks are symbolic links (soft links), potentially-relative references to fungible user-facing filesystem paths, that work across filesystems and respect the permissions of the original. They're a special kind of file. It would work with hard links, but you'd have to make and maintain a whole separate real directory structure with an individual link to every file. People used to do this to efficiently maintain branches of the Linux kernel in the days before bitkeeper, depending on their editor to replace files by rename+copy instead of rewriting in-place. Hard links to directories were removed in an early unix for being hostile to reality and fsck, but were added again in Mac OS 10.5's HFS+ implementation to implement Time Machine's storage.
- deleted 17y ago[deleted]