pauldreik / rdfind

find duplicate files utility
Other
980 stars 79 forks source link

There should be a way to make relative symlinks #66

Closed daleglass closed 3 years ago

daleglass commented 3 years ago

The symlinks being created point to the full path on disk. I'd like to be able to create relative symlinks, so that I can move the data around and back it up and have everything keep working.

marehr commented 3 years ago

Hiho I searched for the same thing, as you can see there is an entry in the man page about this:

https://github.com/pauldreik/rdfind/blob/fa7752d6205e2071a758e7aa2d4e1c541aa96a6e/rdfind.1#L158-L160

You can use https://github.com/brandt/symlinks#convert-absolute-symlink-to-relative for that purpose.

pauldreik commented 3 years ago

Sorry for the late reply. I made the links absolute, because making correct relative symlinks seems nontrivial, given that parts of the paths could be relative, different mount points, hardlinks etc. Maybe I am wrong? Perhaps one could consider an opportunistic approach, where a pure text based manipulation is done, and if the candidate resolves to the same inode, pick that candidate. Else bail out and make it absolute.

pauldreik commented 3 years ago

Here is an issue showing it is not trivial to make this correct: https://github.com/brandt/symlinks/issues/3