I am having some problems with symbolic link recursion. I have a git repo that refuses to leave my computer. I may never write immutable data again out of spite of this circumstance.
There does not seem to be many answers on this topic, or they're pertaining to people explicitly creating these symbolic links; what evil person would do this?
Any idea how to nuke a directory from virtual existence?
Top comments (9)
Have you tried finding all the symlinks (try
find .Trash-1003 -type l
in the first instance) and deleting them individually?I suspect that
rm
is following the links down to delete the nodes first, then backing up the tree. If a symlink is pointing to itself, its parent, or another symlink which is pointing, in turn, to one of those, thenrm
will recurse forever.Running
find
without the-L
option should mean it doesn't try to recurse within linked directories, so it shouldn't get the same problem asrm
.There're probably just one or two problem links and using
rm
on them one a time should work.It looks like it's the
*/
and(/
, but deleting those just throws that same error.surprised you didn't suggest -exec rm -rf {} \; as an addon to the find....
Though, in the case of unusual issues, I tend to prefer going a bit deeper than most people, why not use the inode reference and delete it specifically by inode, though in this particular case, that should be drastically overkill.
rm -rf ./.git should be sufficient.
I didn't suggest that because I don't see how it'd be any better than the original attempt - we've already established that
rm -rf
doesn't work if the directory contains some kind of self-reference. I'm not sure why thefind
came out with that output though, because it looks like it's reporting a lot of things that shouldn't be links.I don't really know though, I'm just guessing.
Your solution might've worked too, but I didn't test it when I moved it off the external usb.
Did you try via terminal running ‘rm -r .git’?
‘rm -rf .git’ will tell it to force delete the symlink and not follow.
Worked, I had to move it off the external drive though. I had to not use my aliases though, which was weird. It would give the error when I tried to move it also.