1 Jul 2009 18:21
Tool to automatically update symlinks when moving files
Does anyone know of a tool that can automatically update symbolic links when moving files around on a filesystem, so as to maintain symlink consistency? For example: /off/the/cuff/example/cake # regular file /off/the/cuff/example/coffee -> ../../../handle/drink /off/the/handle/drink # regular file /off/the/handle/food -> ../../cuff/example/cake $ symlink_updating_mv --top=/off/the /off/the/cuff/example /off/the should result in: /off/the/cuff # directory /off/the/example/cake # regular file /off/the/example/coffee -> ../../handle/drink # removed one "../" /off/the/handle/drink # regular file /off/the/handle/food -> ../../example/cake # removed "cuff/" That is, both links pointing into and out from the directory being moved were updated. The links should also be updated whether they are relative or absolute symbolic links, too. Yes, I realize that this operation requires scanning the intire tree rooted at "--top". However, I do not anticipate renaming directories frequently, so that particular cost would be acceptable to me. Still, I would like to be able to avoid having to manually relink files when I shuffle them around.(Continue reading)
RSS Feed