Some python packages has the following structure: python code in /usr/shared/pyshared/lib_name and symlinks on python sources in /usr/lib/python2.x/dist-packages/lib_name. However, lib_name in /usr/lib is not a symlink itself. Instead the directory tree of pyshared/lib_name is deeply copied and every single file is symlinked.

I want to reproduce this behavior. Given a directory tree I want to make a deep symlink copy of it. Of course it can be done with a simple script with find command, but maybe it can be achieved in a more standard way?

P.S. Ubuntu 14.04 Trusty, if it matters.


Depending on what exactly you're trying to accomplish, you might want to consider GNU Stow - it's designed to act as basically a package manager for things built from scratch, and it works by creating symlinks of the sort you're describing from each package's unshared build directory to a common deployment directory.

It should be able to do what you're asking for, and you'll particularly be interested in the --no-folding option, which makes it create directories and symlink files, instead of its default behavior of symlinking directories directly when only one package refers to them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.