lndir command performs a shadow copy of a directory tree, but using symlinks. Files are symlinked rather than copied, while subdirectories are copied. It works fine, but I also need some kind of
unlndir script that performs the opposite.
In other words, the behavior of
unlndir would be:
- If there's a symbolic link on the target tree pointing to a file in the source tree, remove the symbolic link.
- Perform previous task recursively for all subdirectories that exist in both the source and the target tree.
- If some subdirectory in the target tree becomes empty, remove it.
I realize this is similar to what GNU Stow does, but I am looking for a simpler shell-script based approach.
Do you know of any shell script that can do this?