How to create shadow directory of symbolic links

There are times when it is handy to know how to create shadow directory of symbolic links. I am thinking in particular of the software compilation process, as I have used this technique in very distant past to build X Window System.

The required application is available in X Window System source code as lndir utility.

Installation process

The easiest way to obtain it is to install xutils-dev package.

$ sudo apt-get install xutils-dev

Alternatively you can download package source code, build required dependencies and compile only this utility.

Usage

Provide only source directory to create shadow directory in current work directory.

$ mkdir ags_build
$ cd ags_build
ags_build$ lndir ../ags 
../ags/Manual:
../../ags/Manual/htmlfiles:
../../ags/Manual/tex2rtf:
../../../ags/Manual/tex2rtf/src:
../../../ags/Manual/tex2rtf/docs:
../../ags/Manual/images:
[...]

Provide both source and destination directories to create shadow directory in provided location.

$ lndir /home/milosz/Projekty/ags /home/milosz/Projekty/ags_build/
/home/milosz/Projekty/ags/Manual:
/home/milosz/Projekty/ags/Manual/htmlfiles:
/home/milosz/Projekty/ags/Manual/tex2rtf:
/home/milosz/Projekty/ags/Manual/tex2rtf/src:
/home/milosz/Projekty/ags/Manual/tex2rtf/docs:
/home/milosz/Projekty/ags/Manual/images:
[...]

It will recursively recreate directories and populate them with symbolic links pointing at the real files .

Additional notes

Milosz Galazka's Picture

About Milosz Galazka

Milosz is a system administrator working for a successful Polish company and a long time supporter of Free Software Foundation and Debian operating system.

Gdansk, Poland https://sleeplessbeastie.eu