-1

This is my symlink:

export -> /home/company/test/var/export/

I tried to delete it with rm export/

Output: rm: cannot remove ‘export/’: Is a directory

So I tried unlink: unlink export/

Output: unlink: cannot unlink ‘export/’: Not a directory

muru
  • 207,970
Black
  • 834
  • 1
    Answered in https://askubuntu.com/a/1151007/158442 – muru Feb 05 '25 at 15:58
  • @muru, It doesn't show the case where a trailing slash was used. My answer leads users to the solution, that also used a trailing slash, while the answer you provided does not, so my Q&A is helpful in troubleshooting. People with the same issue can now find this page and it can be helpful to them. – Black Feb 07 '25 at 08:37
  • The answer I linked to is literally about that exact case. Also, the whole point of duplicates is to make questions easier to find, so your question being helpful doesn't make it any less a duplicate. – muru Feb 07 '25 at 12:54
  • @muru Duplicate closure should be based on whether the question (not an answer elsewhere) has been asked before. The presence of an answer describing the same problem in a different context doesn’t make this a duplicate. – Black Feb 10 '25 at 12:10
  • The context is the same: deleting a symlink. – muru Feb 10 '25 at 16:16

1 Answers1

-1

The problem is the trailing slash.

rm export/ fails

rm export works <--

Black
  • 834
  • Note that by saying export/ you are asking to remove the target of the symlink which you expect to be a directory. (This can never work with the rm command.) – user10489 Feb 23 '25 at 12:57